title: Jenkins pipeline not failing stage on batch failure
body: <p>In a jenkins declarative pipeline if I add a step like this:</p>
  
  <pre><code>bat '''dir QWERTY'''
  </code></pre>
  
  <p>it will fail the stage as expected since there is no such directory.</p>
  
  <p>However this is a bat script with many statements so I want to fail as soon as there is an error. I have been used to appending <code>|| exit /b</code> to handle that. But as part of jenkins pipelines this does not seem to work.</p>
  
  <pre><code>bat '''dir QWERTY || exit /b'''
  bat '''dir QWERTY || exit /b %ERRORLEVEL%'''
  </code></pre>
  
  <p>None of the above fail the stage. Why?</p>
  
  <p>A third option:</p>
  
  <pre><code>bat '''dir QWERTY
  if %errorlevel% neq 0 exit /b %ERRORLEVEL%
  '''
  </code></pre>
  
  <p>seem to work though but that hurts the readability of the script.</p>