catch return error just like in unix but now in dos/ batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
flaskvacuum
Posts: 43
Joined: 08 Mar 2013 11:23

catch return error just like in unix but now in dos/ batch

#1 Post by flaskvacuum » 08 Mar 2013 11:27

i am more acustom to unix scripting.

Code: Select all

 findstr "ORA-[0-9]" alert_%%A.log>>%output-file% 


in unix i can catch the return error:

Code: Select all

 if [ $? -ne 0 ]; then echo "there is no ORA-ERROR found on alert log" > $ERRLOG 


Question: how can i do that in DOS / batch file?

mfm4aa
Posts: 70
Joined: 13 Feb 2013 14:02
Location: Europe

Re: catch return error just like in unix but now in dos/ bat

#2 Post by mfm4aa » 08 Mar 2013 11:56

Look at %errorlevel%.
http://ss64.com/nt/findstr.html

flaskvacuum
Posts: 43
Joined: 08 Mar 2013 11:23

Re: catch return error just like in unix but now in dos/ bat

#3 Post by flaskvacuum » 15 Mar 2013 01:25

mfm4aa wrote:Look at %errorlevel%.
http://ss64.com/nt/findstr.html


thanks...i take a look. thank you.

Post Reply