VOGONS


Reply 20 of 37, by DaveDDS

User metadata
Rank Oldbie
Rank
Oldbie

Just for fun, I threw together GENEVL.C which create EVL.BAT:

@echo OFF
%1 %2 %3 %4 %5 %6 %7 %8 %9
echo 0
if errorlevel 1 echo 1
... repeat for 2-254 ...
if errorlevel 255 echo 255

Here is a test run:

R:\> EVL ERRLVL 5
Exit[5] <- produced by ERRLVL
0
1
2
3
4
5
R:\>

Attached .ZIP contains GENEVL.C and the generated EVL.BAT

- Dave ; https://dunfield.themindfactory.com ; "Daves Old Computers" ; SW dev addict best known:
ImageDisk: rd/wr ANY floppy PChardware can ; Micro-C: compiler for DOS+ManySmallCPU ; DDLINK: simple/small FileTrans(w/o netSW)via Lan/Lpt/Serial

Reply 21 of 37, by Cursed Derp

User metadata
Rank Oldbie
Rank
Oldbie

Hello, I tried two of the tools mentioned in the thread. For some reason, DaveDDS's errlevel tool crashes dosbox and igully's errlevel tool shows this screen after running:

The attachment image (4).png is no longer available

Thank you all again for the information and tools provided. If there is something I'm doing wrong or that I'm missing, please let me know

I am as smooth as a gravy train with flaming biscuit wheels.

Reply 22 of 37, by Cursed Derp

User metadata
Rank Oldbie
Rank
Oldbie

I apologize, I hadn't seen davedds's most recent post. I tried genevl and it seems to have worked perfectly while the other tools for some reason didn't.

I am as smooth as a gravy train with flaming biscuit wheels.

Reply 23 of 37, by DaveDDS

User metadata
Rank Oldbie
Rank
Oldbie
Cursed Derp wrote on Yesterday, 20:31:

Hello, I tried two of the tools mentioned in the thread. For some reason, DaveDDS's errlevel tool crashes dosbox and igully's errlevel tool shows this screen after running:w

My tool is called ERRLVL.COM - you are running ERRLEVEL - I think it was posted by someone else, and I've not looked at.

It looks like you are .BAT file of some sort, with commands DOS doesn't recognize in it.

ERRLVL.COM is an executable program which searches for a .COM or .EXE in current directory, then along your path and executes it directly (not via DOS command processor) - this allows it to receive the actual exit code the program terminated with. No batch is involved.

I assure you it works find in DosBox - I use it frequently there.

- Dave ; https://dunfield.themindfactory.com ; "Daves Old Computers" ; SW dev addict best known:
ImageDisk: rd/wr ANY floppy PChardware can ; Micro-C: compiler for DOS+ManySmallCPU ; DDLINK: simple/small FileTrans(w/o netSW)via Lan/Lpt/Serial

Reply 24 of 37, by igully

User metadata
Rank Member
Rank
Member

The problem is that you are running DOSBOX not a real DOS.
It works on a real DOS, like MS-DOS, DR-DOS, PC-DOS, etc.

It is likely that the emulation/simulation of DOSBOX DOS batch file processing API is not complete or accurate.

Reply 25 of 37, by DaveDDS

User metadata
Rank Oldbie
Rank
Oldbie
igully wrote on Today, 01:25:

The problem is that you are running DOSBOX not a real DOS.
It works on a real DOS, like MS-DOS, DR-DOS, PC-DOS, etc.

It is likely that the emulation/simulation of DOSBOX DOS batch file processing API is not complete or accurate.

I'm curious - have you tested this in older versions of DOS?

I've not looked at the script other than the error messages that were posted - I do seem to recall that .BAT file capability was less in oldere versions (but it has been a long time since I looked closely)

Fwiw: ERRLVL.COM works in DosBox (that's probably where I use it most often)

- Dave ; https://dunfield.themindfactory.com ; "Daves Old Computers" ; SW dev addict best known:
ImageDisk: rd/wr ANY floppy PChardware can ; Micro-C: compiler for DOS+ManySmallCPU ; DDLINK: simple/small FileTrans(w/o netSW)via Lan/Lpt/Serial

Reply 26 of 37, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

That's a windows DOS batch file. It definitely will not run on DR-DOS, PC-DOS, etc.

Reply 27 of 37, by igully

User metadata
Rank Member
Rank
Member

It works under MS-DOS 6.22, PC-DOS 6.3, and DR-DOS 7.01.

Lots of things fail on DOSBOX and also it has its own set of inaccuracies. It is extremely easy to set up, which is its most favorable aspect. I do however, prefer PC emulators which are precise and accurate at what they do (with the added complexity to set them up).

Last edited by igully on 2026-04-25, 03:42. Edited 1 time in total.

Reply 28 of 37, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

You know DOSBox can run MS-DOS, right? Just like those other emulators.

Reply 29 of 37, by igully

User metadata
Rank Member
Rank
Member
jmarsh wrote on Today, 03:36:

You know DOSBox can run MS-DOS, right? Just like those other emulators.

Other emulators run DOS. I have just submitted three pictures taken on VirtualBox a minute ago with DOSes I had at hand, but could well have used 86Box or the other emulators of the lot.

Reply 30 of 37, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

I guess you're unaware DOSBox can boot disk images just like those other emulators. In which case it won't be using its own shell, and can run batch files that contain commands only compatible with "windows" DOS.

Reply 31 of 37, by igully

User metadata
Rank Member
Rank
Member

I am aware. But again, it is not a precise emulator/simulator/virtual environment. It is easy to set up but it is not precise at all because it uses shortcuts to achieve faster speeds.

For example, it has troubles handling code that changes on the fly.

Reply 32 of 37, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
igully wrote on Today, 04:07:

I am aware. But again, it is not a precise emulator/simulator/virtual environment. It is easy to set up but it is not precise at all because it uses shortcuts to achieve faster speeds.

For example, it has troubles handling code that changes on the fly.

No it doesn't - the interpreter core looks at each opcode byte as it is executed so there's no assumptions there, and the dynamic core can detect when code memory is changed and either recompile it or flag it as "volatile". Maybe you'd like to give an example rather than just post AI generated responses?

Regardless this has no bearing on DOSBox's ability to run "real" DOS, even the versions that are designed for windows compatibility.

Reply 33 of 37, by igully

User metadata
Rank Member
Rank
Member

There is nothing AI generated in every post I write.

Reply 34 of 37, by igully

User metadata
Rank Member
Rank
Member

Here you have an example of a couple of months ago:
Emu386 - 386 emulator for 286

Look at how DOSBOX confuses an 80188 and an 80186, which both have a different prefetch queue.

Reply 35 of 37, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
igully wrote on Today, 04:20:

Here you have an example of a couple of months ago:
Emu386 - 386 emulator for 286

Look at how DOSBOX confuses an 80188 and an 80186, which both have a different prefetch queue.

DOSBox doesn't emulate either of those CPU types. You're talking about DOSBOX-X which uses completely different emulation at this point.

Reply 36 of 37, by igully

User metadata
Rank Member
Rank
Member

I don't care any nuances. I prefer precise emulation. And this is already going off into a tangent.
You do you for whatever reason fits you. It is still a free world, in some places...

Reply 37 of 37, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

Tangents indeed, since OP's specific question was:

So is there a way in dosbox to use a batch file to find the error level number of an error?