Board logo

标题: IF %ERRORLEVEL%什么时候才等于3? [打印本页]

作者: gool123456     时间: 2010-3-9 15:05    标题: IF %ERRORLEVEL%什么时候才等于3?
经测试,发现:

IF %ERRORLEVEL% 0 :命令正确

IF %ERRORLEVEL% 2 :是因命令格式不正确

IF %ERRORLEVEL% 1 :是因命令参数不正确

那 IF %ERRORLEVEL% 3 是什么时候错误码才等于3 ?

作者: HAT     时间: 2010-3-9 21:43
作者: Hanyeguxing     时间: 2010-3-9 23:57
@echo off&(echo exit /b 3)>han.bat
call han.bat
echo 这个时候就是:%ERRORLEVEL%
del han.bat&pause


Last edited by Hanyeguxing on 2010-3-9 at 23:58 ]

作者: gool123456     时间: 2010-3-10 00:09
的确等于3,厉害!

额···多问些高手,呵呵..为什么:%ERRORLEVEL%在这时会是3呀?

作者: gool123456     时间: 2010-3-10 00:18
看了这里终于明白了:http://www.cn-dos.net/forum/viewthread.php?tid=40915&fpage=1&highlight=exit

感谢版主和Hanyeguxing的积极回答。

今天才发现自己在DOS联盟里是那样的渺小!哈哈。又学了点东西。

作者: zhoupeng243     时间: 2010-9-24 22:21    标题: 你想等于几都行
choice /c:abcdefgh /s /n !please choice one!
if errorlevel 8 goto (echo %errorlevel%)
if errorlevel 7 goto (echo %errorlevel%)
if errorlevel 6 goto (echo %errorlevel%)
if errorlevel 5 goto (echo %errorlevel%)
if errorlevel 4 goto (echo %errorlevel%)
if errorlevel 3 goto (echo %errorlevel%)
if errorlevel 2 goto (echo %errorlevel%)
if errorlevel 1 goto (echo %errorlevel%)