title: Windows command interpreter: how to obtain exit code of first piped command
body: <p>In the example provided below, I execute nmake and then redirect STDOUT/STDERR to tee, which then sends it to the screen, and also to a log file.
  The problem is that I'm trying to capture the exit code for nmake and not tee.
  What I need is the exit code from nmake, and not tee.</p>
  
  <pre><code>nmake | tee output.txt
  </code></pre>