Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Windows XP

Command .bat files and return code

 
Jump to:  
 
Mario - Roma
PostPosted: Sun Sep 21, 2008 6:42 pm    Post subject: Command .bat files and return code
       
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
 

 
Pegasus (MVP)
PostPosted: Sun Sep 21, 2008 7:24 pm    Post subject: Re: Command .bat files and return code
       
"Mario - Roma" <mario@mydomain.local> wrote in message
news:uyyl63CHJHA.2156@TK2MSFTNGP05.phx.gbl...
Quote:
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.
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

srebro advocacy talk odzież dziecięca odżywki Sklep zoologiczny