I would think that you would want RedirectStadardOutput to true .. (then
just read the datastream and write it to a file.
The reason it is not working is that > is handled by the command prompt ..
(it redirects standard output to a file). If you wanted to use it you would
have to actually shell out to cmd and passing the program etc as the
arguments.
http://www.c-sharpcorner.com/Referen...ic.Process.asp
includes an example of reading the output of the program, it is just a
matter of writing the data to a filestream from there.
Cheers,
Greg Young
MVP - C#
Also
"Scott B" <sc************@milliman.com> wrote in message
news:Om**************@TK2MSFTNGP03.phx.gbl...
I have a EXE that spits out text in XML fomat.
I need to call this exe and have it write the XML to a file
I am using the following code:
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.RedirectStandardOutput = false;
p.StartInfo.FileName = "GetData.exe";
p.StartInfo.Arguments = @" -listxml > c:\Output.xml";
p.Start();
My problem is that it never writes the output.xml
If I could rewrite the original application to spit out the data to a file
I would, but I am stuck using it as it stands.
Any ideas>