Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,可以说我有批处理脚本,成功返回 0,错误返回 1,我想打印/将退出值传递给控制台/另一个命令
就像是
echo script param1 param2
预期产出
0 or 1
这如何在windws批处理脚本中完成?
您的脚本此时返回 0 和 1。
添加这个:
@ECHO off :: script comment cmd.exe /c somecommand if errorlevel EQU 0 CALL script2.bat param1 param2 & goto :END if errorlevel GEQ 1 CALL script3.bat param1 param2 & goto :ERROR :ERROR EXIT 1 :END EXIT 0