Does anybody know what is the equivalent to $?
in Windows command line? Is there any?
EDIT: $?
is the UNIX variable which holds the exit code of the last process
Does anybody know what is the equivalent to $?
in Windows command line? Is there any?
EDIT: $?
is the UNIX variable which holds the exit code of the last process
@echo off
run_some_command
if errorlevel 2 goto this
if errorlevel 1 goto that
goto end
:this
echo This
goto end
:that
echo That
goto end
:end
%ERRORLEVEL% Returns the error code of the most recently used command. A non zero value usually indicates an error.
http://technet.microsoft.com/en-us/library/bb490954.aspx
$? Contains True if last operation succeeded and False otherwise. And
$LASTEXITCODE Contains the exit code of the last Win32 executable execution.
http://blogs.msdn.com/powershell/archive/2006/09/15/ErrorLevel-equivalent.aspx
$? Expands to the exit status code of the most recently executed foreground program.