views:

44

answers:

2

Hi

I want to launch Google Chrome from Process.Start method. It works on 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. 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. How can I make it to runnable from Start>Run

A: 

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. I assume that Process.Start() is invoking the same behaviour.

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).

Marcelo Cantos
+1  A: 

On my Win7 machine. Chrome is installed in %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"));
Jesper Palm
I want it to be generic so that it works with Windows XP as well. In worst case, may be I just detect the platform and then specify launch path. I don't know!
ZHS
Since a user can choose where the install an application you cannot be generic in that way. The path the chrome is probably stored somewhere in the registry. Find that value, read it and use that path.
Jesper Palm