Exit code of a batch file?

#1
This is from the LE forum but it is equally appropriate here.

Here are two simple batch files.
Code:
v:\> type chain1.cmd
@echo off
if "%1"=="1" (cmd /c exit 1) else (echo foo)

v:\> type chain2.cmd
@echo off
echo chain2.cmd was executed
Here's the result of conditional execution with CMD.
Code:
V:\> chain1.cmd 1 && chain2.cmd

V:\>
And here's the result with TCC19.
Code:
v:\> chain1.cmd 1 && chain2.cmd
chain2.cmd was executed

v:\>
 
#4
Replace "cmd /c exit 1" with any external that fails. Here's another using "net stop stisvc".

CMD doesn't run the second batch file (seems right).
Code:
V:\> chain1.cmd 1 && chain2.cmd
The Windows Image Acquisition (WIA) service is not started.

More help is available by typing NET HELPMSG 3521.

V:\>
And TCC does run the second batch file.
Code:
v:\> chain1.cmd 1 && chain2.cmd
The Windows Image Acquisition (WIA) service is not started.

More help is available by typing NET HELPMSG 3521.

chain2.cmd was executed

v:\>