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.
有时我会运行以下命令cmd:
cmd
fc /b file1 file2
并希望看到 fc 的返回码。有没有一种简单的方法可以做到这一点?
echo %ERRORLEVEL%
来自 TechNet,命令外壳概述: “%ERRORLEVEL% ... 返回最近使用的命令的错误代码。非零值通常表示错误。”
要测试批处理文件中的特定错误级别,您可能会发现这篇知识库文章很有用。