Capture and display console output at the same time

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-03-16T10:00:57Z Indexed on 2010/03/16 10:16 UTC
Read the original article Hit count: 344

Hi,

MSDN states that it is possible in .NET to capture the output of a process and display it in the console window at the same time.

Normally when you set StartInfo.RedirectStandardOutput = true; the console window stays blank. As the MSDN site doesn't provide a sample for this I was wondering if anyone would have a sample or could point me to a sample?

When a Process writes text to its standard stream, that text is normally displayed on the console. By redirecting the StandardOutput stream, you can manipulate or suppress the output of a process. For example, you can filter the text, format it differently, or write the output to both the console and a designated log file. MSDN

This post is similar to http://stackoverflow.com/questions/786726/capture-standard-output-and-still-display-it-in-the-console-window by the way. But that post didn't end up with a working sample.

Thanks a lot,

Patrick

© Stack Overflow or respective owner

Related posts about redirectstandardoutput

Related posts about .NET