I am trying to call an exe file with multiple command line arguments in C# and capture the output but unsuccessful. Here is what I am doing:
Process
process = new Process();process.StartInfo.UseShellExecute =
false;process.StartInfo.RedirectStandardOutput =
true;process.StartInfo.RedirectStandardError =
true;process.StartInfo.CreateNoWindow =
true;process.StartInfo.FileName =
@"D:\bin\test.exe";process.StartInfo.Arguments =
"-a ipaddress -L C:\\test.txt"; process.Start(); string s = process.StandardOutput.ReadToEnd(); MessageBox.Show(s);It works fine when run the exe on command line with those arguments. Am I doing anything wrong here
thanks a lot for help!
Sue

Process.start with multiple command line arguments..
JonCole
These two lines will be a problem. Use the @ so that backslash is treated literally and not as an escape.
Malcatrazz
ImNoScrub
Thanks! I splited the arguments string like this and it works :
process.StartInfo.Arguments = "-a ipaddress -L " + @"C:\test.txt;
FR6
Nice post, useful very much. I was just working on this last hour.
I believe the simplest way to get around this is
process.StartInfo.Arguments = @"-a ipaddress -L C:\test.txt";
Solves everything.