the problem of redirecting stdout in c#
Posted
by Mher
on Stack Overflow
See other posts from Stack Overflow
or by Mher
Published on 2010-06-16T08:29:50Z
Indexed on
2010/06/16
8:32 UTC
Read the original article
Hit count: 138
Could you please explain why the shell redirection doesn't work with System.Diagnostics.Process class? I am trying to redirect the output streams to file with the following snippet:
Process p = new Process();
p.StartInfo = new ProcessStartInfo();
p.StartInfo.FileName = "java.exe";
p.StartInfo.Arguments = @"> c:\Temp\test.log 2>&1";
p.StartInfo.UseShellExecute = true;
p.Start();
The similar code works without problems with Python. Reading the output streams programmatically doesn't seem a preferable solution in my case because there will be a bunch of processes launched by my application.
© Stack Overflow or respective owner