【发布时间】:2012-06-21 12:01:57
【问题描述】:
我正在编写一个批处理 (.bat) 脚本,我需要处理文件夹删除失败的情况。我使用%errorlevel% 来捕获退出代码,但在rd 命令的情况下它似乎不起作用:
C:\Users\edo\Desktop>rd testdir
Directory is not empty
C:\Users\edo\Desktop>echo %errorlevel%
0
为什么?你有什么建议?
【问题讨论】:
标签: windows batch-file error-handling cmd exit-code