PC Review


Reply
Thread Tools Rate Thread

Command .bat files and return code

 
 
Mario - Roma
Guest
Posts: n/a
 
      21st Sep 2008
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


 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      21st Sep 2008

"Mario - Roma" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SCHTASKS - Job return code instead of return code of Job creation /execution James D Smooth Microsoft Windows 2000 CMD Promt 4 17th Dec 2008 02:36 PM
How can I see a text code, such as the code for 'line return'? =?Utf-8?B?QmxhY2toYXdr?= Microsoft Word Document Management 3 26th Jan 2006 09:15 PM
Userenv 1000. Windows cannot determine the user or computer name. Return value (<return error code>). Ingmar Microsoft Windows 2000 Networking 1 18th Nov 2003 05:08 PM
Userenv 1000. Windows cannot determine the user or computer name. Return value (<return error code>). Ingmar Microsoft Windows 2000 Group Policy 1 18th Nov 2003 05:08 PM
"not all code paths return a value" when throwing exception, can't return a value n_o_s_p_a__m Microsoft C# .NET 5 23rd Jul 2003 08:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:44 PM.