I'm trying to use the find command and errorlevel to evaluate the result of a command
Setlocal EnableDelayedExpansion
...
nssm status MyService | find "SERVICE_STOPPED"
if !errorlevel! equ 0 (
echo MyService is not running
)
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?