title: Detecting PowerShell script is executed with error
body: <p>I have a <em>PowerShell</em> script:</p>
  
  <pre><code>...
  Any-Command -ErrorCode Stop
  ...
  </code></pre>
  
  <p>Then I call this script from a <em>bat</em> script:</p>
  
  <pre><code>...
  powershell myscript.ps1
  ...
  </code></pre>
  
  <p>Now I would like to know in the <em>bat</em> script if the called <em>PowerShell</em> script is stopped on error and not reached the end of the script. How to do it?</p>