如何使用C#打开Google Chrome?
它显示System.ComponentModel.Win32Exception:'系统找不到指定的文件'
我也尝试Process.Start("C:\\Program Files(x86)\\Google\\Chrome\\Application\\chrome.exe");
过,但是它显示了相同的异常
using System;
using System.Diagnostics;
namespace tempTest
{
class Program
{
static void Main(string[] args)
{
Process.Start("chrome.exe");
}
}
}
chrome应用程序路径可以从注册表中读取。您可以尝试以下代码:
var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe", false);
if(key != null)
{
var path = Path.Combine(key.GetValue("Path").ToString(), "chrome.exe");
if(File.Exists(path))
{
Process.Start(path);
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句