带参数的Process.Start()启动Google Chrome [英] Process.Start() with arguments to start Google Chrome

查看:2114
本文介绍了带参数的Process.Start()启动Google Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从.NET程序启动Google Chrome浏览器,并带有参数。但是我收到了奇怪的举动。



以下是从命令行以' incognito '模式启动Chrome的方法。它工作正常。

 C:\程序文件(x86)\Google\Chrome\Application\chrome .exe--incognito 

但是以下内容在.NET中不起作用。 Chrome确实打开了,但没有隐身,并且出现在这个奇怪的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


解决方案

当使用完整路径位置调用 chrome.exe 时,可以使用快捷方式。

  Module Module1 
Sub Main()
System.Diagnostics.Process.Start(chrome.exe, --incognito)
End Sub
End Module

更多:< a href =http://ayumilove.wordpress.com/2009/03/30/start-google-chrome-from-run-windows-key-r/ =nofollow> start-google-chrome-from -run-windows-key -r



UPDATE



我发现你的代码中有什么问题。
您的代码在参数中使用 - incognito ,但它应该是 - 隐身。 p>

查看该参数中的第一个字符。应该是 - ,而不是 -

  Module Module1 
Sub Main()
System.Diagnostics.Process.Start(C:\程序文件(x86)\Google\Chrome\Application\chrome .exe,--incognito)
End Sub
End Module


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

More: start-google-chrome-from-run-windows-key-r

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

这篇关于带参数的Process.Start()启动Google Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆