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.
我有一个批处理程序,它调用了几个子批处理程序,它们广泛使用了各种 Windows 命令。如果出现错误,我想向用户提供有关错误详细信息的日志记录信息。
我如何知道这些命令可以返回的各种错误代码(0 到 256 范围内的数字)以及它们的英文解释是什么?
如果您真的在 DOS 上(我非常怀疑),那么唯一的方法是
command if errorlevel 255 echo 255 if errorlevel 254 echo 254 if errorlevel 253 echo 253 ... if errorlevel 1 echo 1 if errorlevel 0 echo 0
自然语言的解释取决于你,因为你应该知道你在那里做了什么。
请注意,在 Windows 上,您通常可以这样做
command echo %errorlevel%