How to raise (lower) errorlevel in scripts?

This is really common question - how can I raise/lower errorlevel in batches using integrated tools?
In fact there is really simple answer to this question:

Resetting errorlevel:
Just use command
Verify > nul
It will automatically "reset" errorlevel back to normal

Increasing errorlevel to 1:
We can use verify command again:
Verify blablabla 2>nul
Because verify dont know blablabla parameter, it will automatically increase errorlevel to 1.

Do you find it userful? There are many different methods how to increase errorlevel - share your favourite :)   

Published Mon, Mar 27 2006 11:29 by martin
Filed under:

Comments

# re: How to raise (lower) errorlevel in scripts?

May be wrong, but
cmd /c exit N
(where N is de desired errorlevel)
sets de errorlevel to N

Monday, August 07, 2006 10:07 AM by Luis