Check if error uncertain

March 11, 2012 at 03:49:16
Specs: Windows 7
If I check for an error using the command below:
IF ERRORLEVEL 1 GOTO LABEL1
GOTO LABEL0
:LABEL1
XXX
:LABEL0
XXXX
and I have a goto command for the error check at the end of each script launching an exe to lessen the amount of code. Does it check whether the goto command was successful or whether it launched the exe successfully? E.g
start x.exe
Goto Kj
:Kj
IF ERRORLEVEL 1 GOTO LABEL1
GOTO LABEL0
:LABEL1
XXX
:LABEL0
XXXX

See More: Check if error uncertain

Report •

#1
March 12, 2012 at 00:49:20
The ERRORLEVEL stays the same until something changes it. AFAIK GOTO does not produce an errorlevel. GOTO /? says nothing about it, though you can't always trust the help to be complete. In some cases experimentation is the only way to know.

Assuming x.exe does produce an errorlevel, I expect that you will get the results you want.


Report •
Related Solutions


Ask Question