how to redirect the output as well as get the output on shell screen at same time
<p>This is windows-application-form code; I want the batch file which is going to be executed to show the output on shell screen which I got by <code>RedirectStandardOutput = false;</code>, but I also want output to be redirected to a log file at the same time. For this, I use <code>RedirectStandardOutput = true;</code>.</p>

<p>Of course, only one can be used at one time!</p>

<pre><code>System.Diagnostics.Process p = new System.Diagnostics.Process(); 
p.StartInfo.FileName = "c:\test\build.bat"; 

p.StartInfo.UseShellExecute = false; 

p.StartInfo.RedirectStandardOutput = true; // if I use false all the commented lines below are not applicable for comments

p.Start(); 

string output = null; 
//try 
//{ 

output = p.StandardOutput.ReadToEnd(); 

//} 
//catch (Exception ex) 
//{ 
//    MessageBox.Show(ex.ToString()); 
//} 

System.IO.File.WriteAllText("c:\test\log.txt", output); 
</code></pre>
