简体   繁体   English

无法从Process.Start启动进程

[英]Cannot launch process from Process.Start

I want to launch Google Chrome from Process.Start method. 我想从Process.Start方法启动Google Chrome。 It works on Windows XP Process.Start("chrome"). 它适用于Windows XP Process.Start(“ chrome”)。 But it is not working on Windows 7. One thing I noticed that I cannot run chrome from Start>Run. 但是它在Windows 7上不起作用。我注意到一件事,我无法从“开始”>“运行”运行chrome。 May be it is not registered. 可能是未注册。 I tried to uninstall and install again, but did not work. 我试图再次卸载并安装,但是没有用。 I also added full path of Chrome.exe in Path variable of Environment Variables, but still did not work. 我还在环境变量的路径变量中添加了Chrome.exe的完整路径,但仍然无法正常工作。 How can I make it to runnable from Start>Run 如何从“开始”>“运行”使其可运行

On my Win7 machine. 在我的Win7机器上。 Chrome is installed in %USERPROFILE%\\AppData\\Local\\Google\\Chrome\\Application\\ Chrome安装在%USERPROFILE%\\ AppData \\ Local \\ Google \\ Chrome \\ Application \\

And the following works: 和以下作品:

string userProfilePath = Environment.ExpandEnvironmentVariables("%userprofile%");
Process.Start(Path.Combine(userProfilePath, @"AppData\Local\Google\Chrome\Application\chrome.exe"));

I've noticed that Chrome sometimes fires up without a window in Windows 7. You can right-click the taskbar icon and open a new Chrome window from there. 我注意到,有时Windows 7中的Chrome有时会在没有窗口的情况下启动。您可以右键单击任务栏图标,然后从那里打开一个新的Chrome窗口。 I assume that Process.Start() is invoking the same behaviour. 我假设Process.Start()调用了相同的行为。

Of course, this doesn't solve your problem, but hopefully it leads you to an answer (I don't know how to fix this yet; perhaps Google will fix it in an upgrade). 当然,这并不能解决您的问题,但是希望它可以为您提供答案(我尚不知道如何解决;也许Google会通过升级来解决)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM