title: Windows batch: find command and errorlevel
body: <p>I'm trying to use the find command and errorlevel to evaluate the result of a command</p>
  
  <pre><code>Setlocal EnableDelayedExpansion
  ...
  nssm status MyService | find "SERVICE_STOPPED"
  if !errorlevel! equ 0 (
     echo MyService is not running
  )
  </code></pre>
  
  <p>Since I know the command "nssm status MyService" returns "SERVICE_STOPPED" I would expect find to set the errorlevel to 0.
  Instead it's set to 1.
  Why?</p>