Home All Groups Group Topic Archive Search About

How do I capture the output of a command line app in .NET?

Author
13 Dec 2006 6:23 PM
kellygreer1
I know I can execute another app using
System.Diagnostics.Process.Start.
But how do I execute an app where I expect output and capture that
output in a String variable inside of .NET?

Thanks in advance,
Kelly Greer
kellygreer@nospam.com
change nospam to yahoo

Author
13 Dec 2006 8:15 PM
Samik R.
On 12/13/2006 11:23 AM, kellygreer1 wrote:
> I know I can execute another app using
> System.Diagnostics.Process.Start.
> But how do I execute an app where I expect output and capture that
> output in a String variable inside of .NET?
>
> Thanks in advance,
> Kelly Greer
> kellygreer@nospam.com
> change nospam to yahoo
>
You can use the BeginOutputReadLine method on the Process, which will
read the line one by one just like a stream. Then you can process the
line as you like.

HTH.
-Samik

AddThis Social Bookmark Button