title: Powershell: Redirecting stderr causes an exception
body: <p>I encountered this behavior in Powershell and I was wondering why is this happening:</p>
  <p>Running this script:</p>
  <pre><code>$ErrorActionPreference= &quot;Stop&quot;
  cmd /c &quot;echo error 1&gt;&amp;2&quot; 2&gt;log.txt
  
  </code></pre>
  <p>Produces the following output:</p>
  <pre><code>PS D:\playground\Powershell&gt; .\Redirecting-Stderr.ps1
  cmd : error
  At D:\playground\Powershell\Redirecting-Stderr.ps1:3 char:1
  + cmd /c &quot;echo error 1&gt;&amp;2&quot; 2&gt;log.txt
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (error :String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
  
  </code></pre>
  <p>Actually, it doesn't matter what I'm redirecting to, it could be also $null, &amp;1, etc.</p>
  <p>Seems that the mere redirecting of stderr in powershell causes some exception to be raised. Why is that?</p>
  <p>Powershell version: 5.1.17763.1490</p>