title: How to get the return value of console app in a batch file?
body: <p>I have a C# console application <strong>AAA.exe</strong> which can return an integer to indicate the result</p>
  
  <pre><code>static int Main(string[] args)
    {
      . . .
      if(case1)
         return -1;
  
      if(case2)
         Environment.Exit(1);
  
      return 0;
  }
  </code></pre>
  
  <p>I will call <strong>AAA.exe</strong> in a batch file and need the return value</p>
  
  <pre><code>AAA.exe /p="param1"
  </code></pre>
  
  <p>My question is:</p>
  
  <ol>
  <li>how to get the return value of AAA.exe? </li>
  <li>is there any difference between <code>return 0;</code> and <code>Environment.Exit(0);</code> statements?</li>
  </ol>