
批處理文件errorlevel返回值為何出錯
執行上面這段腳本,查詢QQ.exe是否在任務列表里,QQ.exe被我改成了1QQ.exe,返回當然是[1,沒找到,沒找到]但如果這樣換下順序if errorlevel 0 goto findif errorlevel 1 goto nothing再執行的話,卻顯示[1,找到了,找到了]返回值明明是1,卻為什么顯示找到了呢,小弟想不明白,求解釋,謝謝!nclick="copycode($('code0'));">復制代碼
- @echo off
- tasklist | find /i 1QQ.exe
- if errorlevel 1 goto nothing
- if errorlevel 0 goto find
- :nothing
- echo %errorlevel%,沒找到,沒找到
- goto end
- :find
- echo %errorlevel%,找到了,找到了
- goto end
- :end
- pause

