C# Capturing output from a process
namespace LaunchAndCaptureOutput{
class Lacout{
static void Main(){
var proc = new Process{
StartInfo = new ProcessStartInfo{
FileName = @"C:csdevlessonslessonette7hello.exe",
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.Start();
string p = proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
Console.WriteLine("Captured output: " + p);
}
}
}