Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to open google chrome with default profile selection but when I pass argument by
C#
Process.StartInfo.ArgumentList.Add("--profile-directory=\"Default\"");

then Passed arguments are ignored and Profile selection dialog is opened.

What I have tried:

But when I pass the argument by
C#
Process.StartInfo.Argument="--profile-directory=\"Default\"";

then It works fine and Browser is opened with default profile selected.

Is ArgumentList is ignored in .Net6.0 ????
Posted
Updated 15-Feb-23 20:58pm

Quote:
Is ArgumentList is ignored in .Net6.0 ????
Not according to the documentation: ProcessStartInfo.ArgumentList Property (System.Diagnostics) | Microsoft Learn[^].
 
Share this answer
 
Comments
DoingWork 16-Feb-23 2:56am    
I have found solution self. To add in argument list, you need to pass argument in this format --profile-directory=default
While to assign to argument property you need to assign this this format --profile-directory=\"default\"
I have found solution self. To add in argument list, you need to pass argument in this format
C#
--profile-directory=default

While to assign to argument property you need to assign this this format
C#
--profile-directory=\"default\"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900