SCOUG-HELP Mailing List Archives
Return to [ 26 |
May |
2001 ]
>> Next Message >>
Content Type: text/plain
=====================================================
If you are responding to someone asking for help who
may not be a member of this list, be sure to use the
REPLY TO ALL feature of your email program.
=====================================================
When executing more than one program in a pipe, which program returns
the errorlevel?
Specifically, I want to XCOPY some data and TEE the list of xcopy'd
files to a log file and to the screen. I also want to check the
errorlevel returned by XCOPY to find out if XCOPY was successful. (I
can't create the log file and then type it to the screen when XCOPY is
finished because the screen display must be shown while XCOPY is
running.)
XCOPY returns an errorlevel (1,2,3,4 - see HELP XCOPY) if it fails. My
code is similar to:
cd h:
xcopy h:\* /h/o/t/s/e/r/v | tee g:\H-Xcopy.log
if errorlevel 1 echo XCOPY ERROR
My question is:
- will the above code pass the XCOPY "errorlevel" to the "if
errorlevel ..." statement, or
- will the "errorlevel" from TEE instead be passed to the "if
errorlevel ..." statement?
I can't find documentation on this. I can think of three ways the .cmd
file might be executed: 1) pass the errorlevel of the first program in
the pipe, or 2) pass the errorlevel of the last program in the pipe, or
3) pass the highest errorlevel returned by any of the programs in the
pipe.
Anybody have any info on this? Similarly, anybody know what
"errorlevel" is returned to a subsequent "if errorlevel ..." statement
when using &, && and || unconditional/conditional command processing?
- Peter
=====================================================
To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-help".
For problems, contact the list owner at
"rollin@scoug.com".
=====================================================
>> Next Message >>
Return to [ 26 |
May |
2001 ]
The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS
RESERVED.
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
|