VOGONS


First post, by Exploit

User metadata
Rank Newbie
Rank
Newbie

I have written a small assembly program with DEBUG.EXE from FreeDOS 1.3 in DR DOS 3.41 and now i want to know how i can evaluate the return code?

This old DOS version is quite limited. The if command for batch commands can in this version, as far as i know, only test on the existing of files, not on return codes.
Are there any other options while using DR DOS 3.41 to read the return code?

Reply 1 of 1, by jakethompson1

User metadata
Rank Oldbie
Rank
Oldbie

It's "if errorlevel N command" which tests if the errorlevel is N or higher
Since the convention is exit code 0 for success and non-zero for failure, and it is treated as unsigned, if errorlevel 1 tests for success and if errorlevel not 1 would test for failure.
Forgetting the "or higher" part is a common mistake.

More from MS here: https://jeffpar.github.io/kbarchive/kb/069/Q69576/
Since they cite MS-DOS 3.1, presumably it's in DR-DOS 3.x too.