我正在尝试使用 find 命令和 errorlevel 来评估命令的结果
Setlocal EnableDelayedExpansion
...
nssm status MyService | find "SERVICE_STOPPED"
if !errorlevel! equ 0 (
echo MyService is not running
)
由于我知道命令“nssm status MyService”返回“SERVICE_STOPPED”,我希望 find 将错误级别设置为 0。相反,它设置为 1。为什么?