href 带参数 打开exe_带参数的Process.Start()启动Google Chrome

I am trying to launch Google Chrome browser from a .NET program, with arguments. But I get strange behavior.

The following launches Chrome in 'incognito' mode from a command line. It works fine.

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --incognito

But the following does not work in .NET. Chrome does open, but not incognito and it goes to this weird URL: http://xn---incognito-nu6e/

Module Module1

Sub Main()

System.Diagnostics.Process.Start("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "–-incognito")

End Sub

End Module

解决方案

You can use shortcut when call the chrome.exe instead using full path location.

Module Module1

Sub Main()

System.Diagnostics.Process.Start("chrome.exe", "--incognito")

End Sub

End Module

UPDATE

I found what is your problem in your code.

Your code using –-incognito in the parameter, but it should be --incognito.

See the first character in that parameter. Should be - instead –.

Module Module1

Sub Main()

System.Diagnostics.Process.Start("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "--incognito")

End Sub

End Module

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这段代码是一个关于时间片轮法的实现,但是需要注意以下事项: 1. 代码中使用了 `State` 类型,但是没有给出其定义,需要确认其定义是否正确,否则代码会报错。 2. `ready_queue = processes.copy()` 将 `processes` 列表复制一遍,但是如果 `processes` 中的元素是对象,复制得到的只是对象的引用,需要确认是否符合需要。 3. `any(p.state != State.TERMINATED for p in ready_queue)` 用于判断是否还有进程未完成,需要确认代码中是否正确地修改了进程的状态。 4. `processes_in_queue = len(ready_queue)` 用于记录当前队列中的进程数,需要确认代码中是否正确地维护了进程队列。 5. `current_process = ready_queue.pop(0)` 用于从队列中取出下一个进程,需要确认代码中是否正确地维护了队列的顺序。 6. `current_process.run(time_slice)` 用于模拟进程运行,需要确认 `run()` 方法的实现是否正确。 7. `current_process.end_time = current_time` 用于记录进程结束时间,需要确认代码中是否正确地记录了时间信息。 8. `ready_queue.append(current_process)` 用于将进程重新加入队列,需要确认代码中是否正确地维护了队列的顺序。 9. `return [p.end_time - p.start_time for p in processes],[(p.end_time - p.start_time) / p.cpu_time for p in processes],time_slice` 返回了进程的运行时间和 CPU 利用率,需要确认代码中的计算是否正确。 以上是需要注意的事项,希望对你有所帮助。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值