Command .bat files and return code

M

Mario - Roma

I need to create a .bat file to performa some tests required by a third
party application.
The third party application documentation says that
"The script must exit with a 0 (zero) value to be considered
a success. Any other output results in failure. Upon success, the stdout
output of the
script will be examined."
I made some tests but I prseume I made some mistake.
Can anybody please explain how a .bat script must close in order to exit
with a 0 or a non 0 value and, maybe. provide some simple sample?
Regards
Mario
 
P

Pegasus \(MVP\)

Mario - Roma said:
I need to create a .bat file to performa some tests required by a third
party application.
The third party application documentation says that
"The script must exit with a 0 (zero) value to be considered
a success. Any other output results in failure. Upon success, the stdout
output of the
script will be examined."
I made some tests but I prseume I made some mistake.
Can anybody please explain how a .bat script must close in order to exit
with a 0 or a non 0 value and, maybe. provide some simple sample?
Regards
Mario

Error levels (=return codes) are generated by each command included in your
batch file. The batch file itself returns the error level of the last
command you run. You can therefore force a zero error level by making the
last command a "safe" command, e.g. like so:
@echo off
"c:\Some Folder\Some Program.exe"
cd

Line 2 in this batch file might generate a non-zero error level. However,
since Line 3 generates a zero error level, the batch file will return a zero
error level too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top