Discussion Locked

Setting the errorlevel in batch file?

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need to reset the errorlevel in a DOS batch file to return a different exit code than set by a command error within the batch file. No user interaction is possible, so I can't use utilities like DCH or Enquire to set the errorlevel.

Anybody know a utility to do this? I can run another dos program with a predictable exit code like wait.exe, which will reset the errorlevel to 0, but that's only a partial solution.

Thanks,

Russell

5 replies

by tchieng

I wrote a program to do this for you. Email me if you want it. I think it might do what you want.

toupao.chieng@achemists.com

It's called SETERR.EXE. To set an errorlevel of x, put "SETERR x" in your batch file, where x can be any number.

by bryan bowers

I think you can do this with the following command

set errorlevel==xx

It has been a long time since I have done this so let me know if that doesn't work.

This discussion is closed to new replies.