C# windows service location
Posted
by
user743246
on Stack Overflow
See other posts from Stack Overflow
or by user743246
Published on 2012-04-15T03:58:40Z
Indexed on
2012/04/15
5:28 UTC
Read the original article
Hit count: 106
c#
By using following code[C#], we can know the path where googlechrome is installed. But, this code first starts chrome.exe, then takes its path. My question is without starting chrome.exe, how can I know the path?
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "chrome.exe";
string argmnt = @"-g";
startInfo.Arguments = argmnt;
String path = null;
try
{
Process p = Process.Start(startInfo);
path = p.MainModule.FileName;
p.Kill();
}
catch (Exception e)
{
return String.Empty;
}
© Stack Overflow or respective owner