If I make a batch script named temp.bat (for example) containing:
exit /b 1
When I run it in various ways, I get different behavior on my 32-bit XP system vs. a 64-bit XP system.
On 32-bit:
> temp.bat
> echo %ERRORLEVEL%
1
> cmd /c temp.bat
> echo %ERRORLEVEL%
0
On 64-bit:
> temp.bat
> echo %ERRORLEVEL%
1
> cmd /c temp.bat
> echo %ERRORLEVEL%
1
I've searched through the cmd.exe options and I have been unable to find any options controlling how it propagates errorlevel information from batch scripts. At this point I'm unable to find any rational explanation for this difference.