Hi.
I have made a c# app. in which i run another app. using Process. Everything has worked like a charm untill I added another argument to the app.StartInfo.Arguments string. The string I added looks like this: ">build2.log ". Do you know if there are any issues with the char ">" or something? Because when I run my app. in debug mode and copy the argument string and paste it in a regular command line console, the external app. runs fine. But when I run the external app. in my own app it does not execute correctly...
Thanks in advance!
Posted Oct 7, 2008, 8:48 AM
AlanPosted Oct 7, 2008, 5:25 AM
If you're using the command shell, the problem may be caused by not closing the shell afterwards using the /c switch.
For example, to run the DOS command 'dir /od' and redirect output to a file, you would do:
using System;
using System.Diagnostics;
class Test
{
static void Main()
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/c dir /od >build2.log";
p.Start();
}
}
This wouldn't work if you didn't use /c.