VOGONS


First post, by Zup

User metadata
Rank Oldbie
Rank
Oldbie

I've got some games installed in my dosbox folder, using CUE+BIN (i.e. Red Alert) or CUE+BIN+OGG to enable CD Audio (i.e.: HoMaM 2), and also a "pure" DOS system (a Toshiba Laptop). So I'd like to use the same start-up method everywhere. The logic would be

IF dosbox_present THEN
(use imgmount)
ELSE
(no thanks, I will use shsucdx)

So, is there any method of detecting DOSBox from .BAT files? I'm thinking of using something like...

...
VER | FIND "DOSBox"
IF ERRORLEVEL 1 GOTO use_imgmount
(mount the drive using shsucdx)
GOTO start_game

:use_imgmount
(mount the drive using imgmount)
GOTO start_game

:start_game
...

But find is not a DOSBox tool (although it's present on DOSBox-x).

Is there any command that can detect if DOSBox is running and report via errorlevel?

(BTW, I've been unable to find documentation about internal commands that list errorlevel outputs)

I have traveled across the universe and through the years to find Her.
Sometimes going all the way is just a start...

I'm selling some stuff!

Reply 1 of 3, by Grzyb

User metadata
Rank l33t
Rank
l33t

"if exist imgmount.com ..."

Kiełbasa smakuje najlepiej, gdy przysmażysz ją laserem!

Reply 2 of 3, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
@echo off
if exist z:\intro.com goto in_dosbox
echo DOSBox: No
goto end

:in_dosbox
echo DOSBox: Yes

:end

Alternatively just set an environment variable on one platform and not the other.

Reply 3 of 3, by Grzyb

User metadata
Rank l33t
Rank
l33t
Zup wrote on 2025-01-02, 09:31:

BTW, I've been unable to find documentation about internal commands that list errorlevel outputs

In DOS, internal commands don't set the ERRORLEVEL.

ERRORLEVEL = exit code returned by the previously running program.
Internal commands are handled by COMMAND.COM, which never exits, hence no exit code.

Kiełbasa smakuje najlepiej, gdy przysmażysz ją laserem!