我知道有内置的Internet Explorer,但我想要的是打开指定URL的Firefox/Mozilla窗口(运行应用程序)。有人可以告诉我如何在C#(.NET)中实现吗?
你可以这样做:
System.Diagnostics.Process.Start("firefox.exe", "http://www.google.com");
这将启动系统定义的默认浏览器:
string url = "http://stackoverflow.com/";
System.Diagnostics.Process.Start(url);
记住,如果浏览器未正确配置,Process.Start(url) 可能会抛出异常。
请参考 ProcessInfo.UseShellExecute
如果你明确不想使用用户默认的浏览器,你可以以URL作为第一个参数运行浏览器。
C:\Program Files\Mozilla Firefox>firefox.exe http://google.com
为我启动带有 Google 的 Firefox。但正如其他人所说,您可能会面临未安装或安装在不同位置等风险。