title: How to redirect powershell.exe OUPUT and ERROR to two separate files?
body: <p>I need to redirect the STDERR and STDOUT to two separate files.</p>
  
  <p>I tried the following:</p>
  
  <ul>
  <li><p>This will output error only to an error file:</p>
  
  <pre><code>powershell.exe -file c:\test.ps1 2&gt; test.txt
  </code></pre></li>
  <li><p>This will output all output to a result file:</p>
  
  <pre><code>powershell.exe -file c:\test.ps1 2&gt;&amp;1&gt; test.txt
  </code></pre></li>
  </ul>
  
  <p>My question is how can I redirect STDERR and STDOUT to two separate files by running <code>powershell.exe</code> just once?</p>