title: What is the syntax for executing a Perl script and capturing its exit value in Windows batch script?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line">How do I get the application exit code from a Windows command line?</a>  </p>
  </blockquote>
  
  
  
  <p>The Perl script that I'm calling inside batch returns a <code>1</code>, <code>2</code>, or <code>3</code>. What's the syntax for calling this perl sript with an argument 829, and capturing the script's exit code?</p>
  
  <pre><code> Perl.exe listMembership.pl 829 in cmd.exe
  
   @echo off
   set retVal=Perl.exe listMembership.pl 829
   echo %retVal%
  </code></pre>