VOGONS

Common searches


automount first CD-drive

Topic actions

First post, by szekeres2009

User metadata
Rank Newbie
Rank
Newbie

Hello folks! I am trying to edit the config autoexec to automount te first physical Optical drive as drive D on any host computer I run it. Is it possible to do that? I am about to make an auto installer for a game, but no CD image will be included of course so dosbox could automount the first CD drive. Thank you.

Reply 1 of 28, by Neville

User metadata
Rank Oldbie
Rank
Oldbie

Just add this line to the "Autoexec" section of DOSBox.conf:

Z:\>MOUNT D D:\ -t cdrom

However, I advise you not to do it. Unless you have a disc inserted, DOSBox will return an error message everytime you run it. And in many PCs D: is mapped to a second hard drive, making the instruction useless.

Reply 3 of 28, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

You could probably script something using the output of the "mount -cd" command.

How To Ask Questions The Smart Way
Make your games work offline

Reply 5 of 28, by szekeres2009

User metadata
Rank Newbie
Rank
Newbie

Hm I was wondering how this could be done with the "-usecd" switch the readme sas that the number after mount -usecd is the number we get after mount -cd, but when I type in mount -usecd 0 it doeasn't work, could someone give an example how to use the -usecd switch to do this?

Reply 6 of 28, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

I was referring to taking the output of "mount -cd" and then creating a batch file to mount your D:\ based on the output of that command.

How To Ask Questions The Smart Way
Make your games work offline

Reply 9 of 28, by gidierre

User metadata
Rank Member
Rank
Member

well it's pretty cumbersome but there is a way (or cumbersome is the way I can think of doing it, since probably it could be streamlined)

I have no idea whether DosFreak had something like this on his mind, anyway

suppose you made one c:\dosbox dir and you use the mount -cd syntax, we know what it does don't we and direct it to a cdrom.txt or something, like in

mount -cd > cdrom.txt

exiting dosbox, we're back into the batch,
then go ahead and use find on this txt, like

find /i "0." cdrom.txt

right?

now use set /p (only interactivity required) to pinpoint the letter of drive 0

set /p drive_letter=drive letter of first cdrom is =

at this moment what's onscreen for me is

C:\dosbox>my_batch […]
Show full quote

C:\dosbox>my_batch

---------- CDROM.TXT
0. D:\
drive letter of first cdrom is =

store and feed it to dosbox commanding so

mount d %drive_letter%:\ -t cdrom

automate it to look like a batch like this (tested a bit w/0.72 as you see and it works):

@echo off
cd "c:\program files\dosbox-0.72"
dosbox.exe -c "mount c c:\dosbox" -c c: -c "mount -cd > cdrom.txt"
cd c:\dosbox
find /i "0." cdrom.txt
set /p drive_letter=drive letter of first cdrom is =
cd "c:\program files\dosbox-0.72"
dosbox.exe -c "mount d %drive_letter%:\ -t cdrom" -c "mount c c:\dosbox" -c c:

as I said I have no clue this is somewhere close to what DosFreak hinted at, but it should work.

We often forgive those who bore us, but we cannot forgive those whom we bore. (La Rochefoucauld)

Reply 12 of 28, by gidierre

User metadata
Rank Member
Rank
Member
szekeres2009 wrote:

This would be so nice if it could its job without hitting a button

you mean without any keystrokes or supplementary clicks?
well, frontends are for that..
or my setup I already mentioned: its scope being precisely to minimize "interactivity"

or sticking to the example I just gave building on mount -cd
even that could be optimized further if necessary

the moment dosbox needs to be manually closed, after
mount -cd > cdrom.txt
can be ironed out in the script by killing the task (dosbox.exe) right on so it goes ahead without a click

the drive letter picking out might also be made a little more user-friendly

if you look up dos_programs.cpp in dosbox source you can spot this:

		// Show list of cdroms
if (cmd->FindExist("-cd",false)) {
int num = SDL_CDNumDrives();
WriteOut(MSG_Get("PROGRAM_MOUNT_CDROMS_FOUND"),num);
for (int i=0; i<num; i++) {
WriteOut("%2d. %s\n",i,SDL_CDName(i));
};
return;
}

where mount -cd gets implemented

if you can edit that so it boils down to something like

		if (cmd->FindExist("-cd",false)) {
WriteOut("Cdrom drive letter is %s\n",SDL_CDName(0));
};
return;
}

and then in the script the lines with find and following become

find /i "letter" cdrom.txt
echo.
set /p drive_letter=Please, type cdrom letter (d, e, f...) =

then its output will look something like

---------- CDROM.TXT
Cdrom drive letter is D:\

Please, type cdrom letter (d, e, f...) =

you still have to state the letter, that's true, but afterwards it's all going smoothly, I guess

after the final
-c "mount c c:\dosbox" -c c:
commands I wrote, for instance for Tomb Raider you could concatenate
-c "cd tombraid" -c dir
in a row, or whatever you deem fit
what about it?

We often forgive those who bore us, but we cannot forgive those whom we bore. (La Rochefoucauld)

Reply 13 of 28, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

why no -c exit in the dosbox lnes ?
anyway this auto mounting the first cdrom seems a bit like I want to distribute the game + dosbox to others as easy as possible.

Water flows down the stream
How to ask questions the smart way!

Reply 14 of 28, by gidierre

User metadata
Rank Member
Rank
Member
Qbix wrote:

why no -c exit in the dosbox lines ?

well, actually I tried to use -c exit but for some reason it didn't work
neither in
dosbox.exe [-c exit] -c "mount c c:\dosbox" -c c: -c "mount -cd > cdrom.txt"

nor in
dosbox.exe [-c exit] -c "mount d %drive_letter%:\ -t cdrom" -c "mount c c:\dosbox" -c c:

no avail
the way I can see it, as per readme definitions:

dosbox [name] [-exit]
-exit
DOSBox will close itself when the DOS application "name" ends.

is because no app "name" had been specified there
otherwise I have no clue why

so I just had to taskkill it (with /f and /t flags) or close manually.

We often forgive those who bore us, but we cannot forgive those whom we bore. (La Rochefoucauld)

Reply 16 of 28, by gidierre

User metadata
Rank Member
Rank
Member
szekeres2009 wrote:

Isn't the programname simply "DOSBOX" ?

you mean, as in: dosbox [name]?
no way, afaik it's just the app and/or dir that dosbox's working on
see the readme:

dosbox [name] name If "name" is a directory it will mount that as the C: drive. If "name" is an executable […]
Show full quote

dosbox [name]
name
If "name" is a directory it will mount that as the C: drive.
If "name" is an executable it will mount the directory of "name"
as the C: drive and execute "name".

---------------------------------------------------------

Qbix wrote:

why no -c exit in the dosbox lnes ?

Qbix, I found it at last
both -c exit and -exit fail on me, but the right thing seems to be going -c "exit"
at end of line and so it does its thing, packs it in and I can drop taskkill now:

start dosbox.exe -c "mount c c:\dosbox" -c c: -c "mount -cd > cdrom.txt" -c "exit"
REM taskkill /f /im dosbox.exe /t

another one:
curiously though, right thereafter, down the lines of that little test script:

cd c:\dosbox
:d
findstr "D:" cdrom.txt
if errorlevel 1 goto e
set drive_letter=d
goto found
:e
findstr /i "e:" cdrom.txt
if errorlevel 1 goto f
set drive_letter=e
goto found

unless I insert a pause right after cd c:\dosbox and before findstr,
findstr won't recognize cdrom.txt as if it was running ahead of its shadow so to speak 😵

I tested and if I place a couple of dir's around pause this way

start dosbox.exe -exit -c "mount c c:\dosbox" -c c: -c "mount -cd > cdrom.txt" -c "exit"
REM taskkill /f /im dosbox.exe /t
cd c:\dosbox
dir
pause
dir
:d
findstr "D:" cdrom.txt
if errorlevel 1 goto e
set drive_letter=d
goto found

the output shows that only the 2nd dir displays cdrom.txt in c:\dosbox...
anyone want a screenshot 😀
55YJI.jpg

no wonder without one pause command thrown in, the following lines exited with an error about cdrom.txt not found

isn't it funny?

EDIT
of course a sleep or a delay by ping can make up a valid stand-in for that pause.

We often forgive those who bore us, but we cannot forgive those whom we bore. (La Rochefoucauld)

Reply 17 of 28, by kingarthur1

User metadata
Rank Newbie
Rank
Newbie

I am New here and am learning the system.

Instead of going through all that couldn't you just write this in the config

mount d d:\ -t cdrom

mount e e:\ -t cdrom

mount f f:\ -t cdrom

mount g g:\ -tcdrom

I know know dosbox would mount all it could but, it would still use the first cd drive it mounted? Is this correct or just a pipe dream

Reply 18 of 28, by gidierre

User metadata
Rank Member
Rank
Member

Instead of going through all that couldn't you just write this

yep, but only in what they call pseudo-code

irl I'm afraid things don't get that simple

for instance, you'd be supposed to handle the host of drive not ready etc. warnings that would follow through
not to mention that you'd still need to get the correct actual drive ID that goes through to go ahead wouldn't you...

all this no doubt could be, and usually gets, done manually,
but the OP's point iirc was to make mount work out automagically.

We often forgive those who bore us, but we cannot forgive those whom we bore. (La Rochefoucauld)

Reply 19 of 28, by kingarthur1

User metadata
Rank Newbie
Rank
Newbie

Like I said I am learning the system. I will explain what I have done so far. I have taken all the contents of dosbox and under a killing moon and combined them into one folder. Through installjammer I call the main install dir c:\oldgames\moon. I also point to dosbox.exe as the main executable. When I run installer it creates dir c:\oldgames\moon and dumps all files in it. Dosbox.exe is run automatically. The config is predetermined by what I have done before the installer has even been run. I have included the files as stated in my past reply and it works. I have gotten no errors at all. I do not know how to do screen shot but will learn and show a picture of the post. I have set the config to pause so I could see any errors and there is none. When you push a button to continue it loads the first available cd drive and works without a problem. The first disc of that game is basically all intro but, when it asks for disc two it accepts with no problem.