title: Log to text file from Process.Start
body: <p>I am starting a process using Process.Start(ProcessStartInfo).  It currently brings up a console window and the output of the process is displayed there until the process completes, in which case the console window closes automatically.</p>
  
  <p>The process outputs a lot of text, so I do not just want to redirect this output to a string, like examples I have found so far.</p>
  
  <p>How can I get the text of the console output to go into a text log file?</p>
  
  <pre><code>ProcessStartInfo myPSI = new ProcessStartInfo();
  myPSI.FileName = myFileName;
  myPSI.Arguments = myArgs;
  myPSI.CreateNoWindow = false;
  myPSI.UseShellExecute = false;
  myPSI.WindowStyle = ProcessWindowStyle.Hidden;
  
  try
  {
    using (Process exeProcess = Process.Start(myPSI))
    {
      exeProcess.WaitForExit();
    }
  }
  catch
  {
  }
  </code></pre>