It is possible to open a new instance of Chrome from C#?
By instance I mean a new separate tab, not contained in an existing chrome window.
I've tried the following solutions but both of them create a new tab in an existing chrome window or creates an instance if no one exists:
Process.Start(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "www.google.com");
Process.Start("chrome.exe", "www.google.com");
I want to create always a separate window, even if there are existing Chrome windows.
To be clear, at the end I want something like that (when I hover on the chrome icon in the taskbar):
And not something like that:
I've searched everywhere and I haven't found a clear answer that says me if this is even possible or not from C#.
Thank you.
Just add chrome to you task bar. Right click and choose new window. Easy cheesy...
Open Chrome Using Command PromptOpen Run by typing “Run” in the Windows 10 search bar and selecting the “Run” application. Here, type Chrome and then select the “OK” button. The web browser will now open.
Press Alt+Shift+D to duplicate the current tab (Option+Shift+D on Mac).
Firstly, go to settings and then click on the search settings. Secondly, access the “Where results Open” and then pick the “Open each selected result in a new browser window” option.
Shorter version, looking first for chrome then for firefox (the syntax is different)
strURL="http://myurl.com";
try
{
//Launch Chrome in a new window
System.Diagnostics.Process.Start("chrome", strURL+" --new-window");
}
catch
{
try
{
//Chrome not found ... launch Firefox in a new window
System.Diagnostics.Process.Start("firefox", "-new-window "+ strURL);
}
catch
{
//WARN THE USER TO INSTALL A BROWSER...
}
}
You can do it by passing --new-window
argument to the process
x86
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
process.StartInfo.Arguments = "google.com" + " --new-window";
process.Start();
x64
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files\Google\Chrome\Application\chrome.exe";
process.StartInfo.Arguments = "google.com" + " --new-window";
process.Start();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With