batch errorcode -> stop the update

Hi,

I created a batch file that runs and checks for some items, installs items if needed, and checks again if they are installed.

If something goes wrong I want to cancel the update from the bat file. I tried to return an error code but wyupdate ignores it and goes on.

So my question is:How can I cancel the update from a bat file?

Greetings

Thanks for the answer but as said in the accepted answer:

exit /b %errorlevel%

does not stop wyupdate, however this does:

exit %errorlevel%

found the idea to try this here:http://social.technet.microsoft.com/Forums/systemcenter/en-US/5b5b3755-8d5d-4d41-811d-08b17d220648/returning-an-error-to-sccm-from-a-batch-file-or-vb-script?forum=configmgrswdist