VOGONS

Common searches


First post, by Darkstar

User metadata
Rank Newbie
Rank
Newbie

Hi,

I needed this feature (i.e. right-click on any directory and launch DosBox with C:\ mounted to that directory) so I hacked it up, and I figured others might want that too. So here it is.

First, copy your dosbox.conf file to a new file (for me it's called "empty.conf") and then remove all autoexec entries from it. Make sure the last line reads [autoexec] and nothing else comes after that (except a newline).

Then, copy this file to your dosbox directory as "dosbox_from_here.cmd" and edit the paths at the top:

@echo off

REM edit this to suit your needs!
set DOSBOXPATH=E:\Games\Dosbox
set CONFTEMPLATE=empty.conf
set CONFNAME=temp.conf

copy %DOSBOXPATH%\%CONFTEMPLATE% %DOSBOXPATH%\%CONFNAME%
echo mount c: %1 >> %DOSBOXPATH%\%CONFNAME%
echo c: >> %DOSBOXPATH%\%CONFNAME%

%DOSBOXPATH%\dosbox.exe -conf %DOSBOXPATH%\%CONFNAME%

del %DOSBOXPATH%\%CONFNAME%

then, create this .reg file and import it into your registry. Make sure you change the path to your cmd file in here, too:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\dosbox]
@="DosBox from here..."

[HKEY_CLASSES_ROOT\Directory\shell\dosbox\command]
@="E:\\Games\\DosBox\\dosbox_from_here.cmd \"%1\""

Doubleclick the .reg file to import it into the registry.
That's it! Right-click any directory (it also works for directories with spaces in the path!) and choose "DosBox from here..." to open dosbox in that specific directory.

Have fun!

Exercise for the reader: make it work for drives, too. It's easy, I was just too lazy to add that, too.

Exercise 2: error detection/recovery. I know, I'm lazy 😉

-Darkstar