Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Launch Chrome from C#
internal static class ChromeLauncher
{
private const string ChromeAppKey = @"\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe";
private static string ChromeAppFileName
{
get
{
return (string) (Registry.GetValue("HKEY_LOCAL_MACHINE" + ChromeAppKey, "", null) ??
Registry.GetValue("HKEY_CURRENT_USER" + ChromeAppKey, "", null));
}
}
public static void OpenLink(string url)
{
string chromeAppFileName = ChromeAppFileName;
if (string.IsNullOrEmpty(chromeAppFileName))
{
throw new Exception("Could not find chrome.exe!");
}
Process.Start(chromeAppFileName, url);
}
}
@fredrikhaglund

This comment has been minimized.

Copy link
Owner Author

@fredrikhaglund fredrikhaglund commented Jun 20, 2014

@jogibanger

This comment has been minimized.

Copy link

@jogibanger jogibanger commented Jul 19, 2016

HI Fredrikhaglund,
can you some help .. I want google chrome in my windows application

@lin-zy1229

This comment has been minimized.

Copy link

@lin-zy1229 lin-zy1229 commented Nov 21, 2016

Great~!!!

@shhhidan

This comment has been minimized.

Copy link

@shhhidan shhhidan commented Mar 28, 2017

Why don't you want to use single one line
Process.Start("chrome.exe", url);
instead?

@SaSiNO97

This comment has been minimized.

Copy link

@SaSiNO97 SaSiNO97 commented Oct 29, 2018

Why don't you want to use single one line
Process.Start("chrome.exe", url);
instead?

Because that requires the Chrome folder being in the PATH environment variable

@reyou

This comment has been minimized.

Copy link

@reyou reyou commented Jun 19, 2019

Works great thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment