我有以下行命令: 如果%ERRORLEVEL%當量1( set/a error=1
if not exist "error.log" echo. > "error.log"
echo the procedure has got an error >> "error.log"
echo. >> "error.log
)
爲什麼ERRORLEVEL在這兩種情況下表現不同? 在命令行: Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>aescrypt.exe -v 2> NUL
C:\>echo %errorlevel%
9009
對戰從批處理文件: @echo off
set
,我有以下窗口批處理代碼: for %%i in (iidbms iigcc iigcd dmfacp dmfrcp rmcmd qwerty) do (
tasklist | findstr /i %%i
echo %errorlevel%
if %errorlevel% == 0 (echo %%i ok process found %errorlevel%)