title: Getting CMD output via Process.Start with UseShellExecute = true in C#
body: <p>I need to run an elevated command in my c# application and get the output.</p>
  
  <p>I'm creating a new <code>System.Diagnostics.Process</code> instance, coupled with a new <code>System.Diagnostics.ProcessStartInfo</code> instance.</p>
  
  <p>The command is being sent to <code>cmd.exe</code>, and unfortunately may require elevated user access (meaning <code>UseShellExecute = true</code> and <code>Verb = "runas"</code> must be present). </p>
  
  <p>As a result of using <code>UseShellExecute = true</code>, <code>RedirectStandardOutput</code> will not work.</p>
  
  <p>It's important I record the output of the command, but the only way I can see of getting this is adding something like <code>&gt; output.txt</code> to the argument list, then calling <code>System.IO.File.ReadAllText</code> to read the result.</p>
  
  <p>Can anyone think of less hacky way?</p>