Windows

Our forums are currently in maintenance mode and the ability to post is disabled. We will be back up and running as soon as possible. Thanks for your patience!

General discussion

Locked

Setting the errorlevel in batch file?

By rejohnson ·
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

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Setting the errorlevel in batch file?

by tchieng In reply to Setting the errorlevel in ...

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.

Collapse -

Setting the errorlevel in batch file?

by rejohnson In reply to Setting the errorlevel in ...

Poster rated this answer

Collapse -

Setting the errorlevel in batch file?

by Bryan Bowers In reply to Setting the errorlevel in ...

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.

Collapse -

Setting the errorlevel in batch file?

by rejohnson In reply to Setting the errorlevel in ...

Poster rated this answer

Collapse -

Setting the errorlevel in batch file?

by rejohnson In reply to Setting the errorlevel in ...

This question was closed by the author

Related Discussions

Related Forums