vb.net 在特定浏览器中打开网址
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19123154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Opening url in specific browser
提问by Jonas Mohr Pedersen
I'm developing a program for my work, but am encountering a problem.
我正在为我的工作开发一个程序,但遇到了一个问题。
The purpose of the program, is to open different websites in a chosen browser on the click of a button. In the software, i give the user the abillity to choose whether to use chrome or IE to open the websites.
该程序的目的是通过单击按钮在选定的浏览器中打开不同的网站。在软件中,我让用户可以选择是使用chrome还是IE打开网站。
I've tried using System.process.Start("URL")to open websites. This works, but it opens the url in the browser which is set as default in windows.
我试过用System.process.Start("URL")打开网站。这有效,但它会在浏览器中打开 url,该 url 在 windows 中设置为默认值。
I however, want the software to open the URLs in a user-chosen browser, by using the file path to the browser.exe - or any other way to do it.
但是,我希望该软件通过使用 browser.exe 的文件路径或任何其他方式在用户选择的浏览器中打开 URL。
回答by Derek
Then you probably need the full path to the executable(s) to use with Process.Start.
那么您可能需要与 Process.Start 一起使用的可执行文件的完整路径。
Or they need to be on your path:
或者他们需要在你的路上:
System.Diagnostics.Process.Start( "Firefox.exe", url );
System.Diagnostics.Process.Start("Firefox.exe", url );

