I'm trying to run this command with several quotation marks:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --proxy-server="10.10.10.10:9999" -user-data-dir=C:\filterbypass www.example.com"
I've tried adding backslashes to the before C and after com, no luck
Tried assigning it to a string
string \"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --proxy-server="10.10.10.10:9999" -user-data-dir=C:\filterbypass www.example.com\"
with hopes to run the command like that, but still nothing.
try
{
System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --proxy-server="10.10.10.10:9999" -user-data-dir=C:\filterbypass www.example.com");
}
catch { }
Can anyone show me where I'm going wrong here? Thanks,
You need to separate the binary to run from the arguments. I would recommend using ProcessStartInfo
to make this clearer:
var info = new ProcessStartInfo
{
FileName = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
Arguments = "--proxy-server=10.10.10.10:9999 " +
@"--user-data-dir=C:\filterbypass " +
"www.example.com"
};
var process = Process.Start(info);
(Note the use of --
for the user-data-dir
switch, by the way - it looks like all the command line flags are prefixed with --
, not -
. It's possible that it works both ways...)
See more on this question at Stackoverflow