Why does ERRORLEVEL behave differently in these two circumstances?
From the command line:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>aescrypt.exe -v 2> NUL
C:\>echo %errorlevel%
9009
Versus from batch file:
@echo off
set /P C="> "?
set or=
if "%C%"=="a" set or=1
if "%C%"=="A" set or=1
if defined or (
aescrypt.exe -v 2> NUL
echo %errorlevel%
)
Result:
> a
1