title: How do I Pipe Standard Error to a File in DOS (Batch File)?
body: <p>How do I pipe standard error to a file in a DOS batch file? Piping using <code>&gt;&gt;</code> only pipes the standard output and the standard error still goes to the console.</p>
  <h1>Details of my issue:</h1>
  <p>I am running WinRAR via command line, in an automated daily backup. And the following example pipes WinRar's output, but not the error output which is what I want most, to <code>winraroutput.txt</code>:</p>
  <pre><code>RAR.exe a -esh -r &quot;E:\backup.rar&quot; &quot;D:\*.*&quot; &gt;&gt; winraroutput.txt
  </code></pre>
  <p>The issue is sometimes files are in use and when they are I want to know they were missed in the archive and record this in a <code>.txt</code> file next to each <code>.rar</code> file in case we ever have to go back. The missing files are easily replaced by reinstalling programs so it's no big deal to replace them, as long as we know they are missing. So it's just information that would be great to know, not necessary, in the time of need.</p>
  <p>How do I output just the standard error output to the <code>.txt</code> file and, if possible but not necessary, leave the the regular output to the console?</p>
  <h1>Bonus points:</h1>
  <p>Bonus points if you can tell me how to delete the file if it's blank (no errors)! Asked here: <a href="https://stackoverflow.com/questions/9378972/how-do-i-detect-and-delete-a-file-if-it-is-empty-using-a-dos-batch-file">How do I Detect (and Delete) a File if it is Empty using a Windows Batch File?</a>.</p>