Sunday, August 2, 2009

Open in DOSBox

I spent some time mucking around to figure out the best way to set up a right-click context menu to open a file in DOSBox. I tried many things, and discovered that there is no way to get the current directory from the parameters passed to the context menu entry by explorer when you click on it. One would either have to write a program for DOS to use in DOSBox that would strp the filename off of the %1 variable, or some other such awkward solution. My (albeit slightly dangerous) solution is to mount the entire disk as the C drive, so that the absolute path provided in %1 works.

Without further ado, here is the .reg file content to get this going with DOSBox 0.73 installed to the default location:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Open in DOS]

[HKEY_CLASSES_ROOT\*\shell\Open in DOS\command]
@="\"c:\\program files\\dosbox-0.73\\dosbox.exe\" -c \"mount c c:\\\" -c \"c:\" -c \"%1\" -c \"exit\" -noconsole"

Note that you'll have to modify this to suit your needs, by changing the DOSBox  version, location, and adding extra -c "mount c c:\" switches for any additional drive letter you wish to use.

1 comment:

  1. I am the author of this blog, new account, same me. Anywho it's worth noting that as of DOSBox 0.74 it takes in a program to run and automates much of what I had to script in with messy "-c" commands.

    ReplyDelete