1

I have 3 chrome profiles and I'm using C# WinForms 2022 to load each profile in a single panel in a WinForm. I know how to launch, for example, the private profile in a single panel, something like this

var url = "https://google.com";
var process = new Process();
process.StartInfo = new ProcessStartInfo("chrome.exe");
process.StartInfo.Arguments = url + " --incognito";

The above code works well. But now I'm trying to add two panels to the same form and load chrome profiles 2 and 3 into panels 2 and 3 respectively.
I'm using the following code for profile 3 but it doesn't do any good to me

var url = "https://google.com";
var process = new Process();
process.StartInfo = new ProcessStartInfo("chrome.exe");
process.StartInfo.Arguments = url + @"--profile-directory =""Profile 3""";

or

process.StartInfo.Arguments = url + "--profile-directory=\"Profile3\"";

I'm unable to load a specific profile in any panel except the private profile and the default one.

Could anyone tell me what is wrong with this code?

Stephan Bauer
  • 9,120
  • 5
  • 36
  • 58

1 Answers1

0

below code is working i think you missed the space near to --profile.

var url = "https://google.com";
            var process = new Process();
            process.StartInfo = new ProcessStartInfo("chrome.exe");
            //process.StartInfo.Arguments = url + " --incognito";
            process.StartInfo.Arguments = url + @" --profile-directory=""Profile 2""";
senthilkumar2185
  • 2,536
  • 3
  • 22
  • 36
  • Yes, it works. Thanks a lot. This space drove me crazy!! – Kevin Fredrick Dec 01 '21 at 13:45
  • @Stephan Bauer , Can please take a quick look at [this question](https://stackoverflow.com/questions/70186553/how-to-load-two-chrome-profiles-into-two-panels-in-c-sharp-winform), it is related to this question as well. Thanks – Kevin Fredrick Dec 01 '21 at 15:10