Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

findstr exit codes / errorlevels

Status
Not open for further replies.
Feb 9, 2006
41
0
0
NL
Hi,

First of all, I'm a scripting newbie. I'm currently busy building a script which is a part of an elaborate bare metal recovery procedure ..

Now, the problem I'm facing is as follows. I'll paste the script for all to see and maybe help me out..

type %systemdrive%\Progra~1\Cristie\CBMR\Logfiles\ba_cbmr_1.err | findstr /g:%systemdrive%\Progra~1\Cristie\CBMR\errmsg.txt
if errorlevel = 0 goto error_exit
goto end_exit

Now, the thing is, the 'type' and findstr work great. No problems there. It finds the errors that may occur this way; but regardless if there *are* any errors or not, it will always move on to the error_exit routine.

Maybe I'm not too familiar with exit codes, but I have 2 assumptions:

1) Findstr runs perfectly well, it finds the file it should and compares it with the error log mentioned in the type command. Therefore it exits with errorcode 0.

2) I'm not using the errorlevels correctly and will therefore never find the right solution.. Google doesn't tell me much about exit codes, except on sites that I need to pay for to see the answer!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top