xor_NTG xor_NTG - 1 year ago 133
C# Question

Open a new window of Google Chrome from C#

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

enter image description here

And not something like that:

enter image description here

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.

Answer Source

You can do it by passing --new-window argument to the process

Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
process.StartInfo.Arguments = "google.com" + " --new-window";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download