Creating Custom configuration files in DOSBox
While the default DOSBox configuration will work with most titles, certain DOS games will require special options to be set in order to run correctly or optimally under DOSBox. Rather than trying to set these options each time you play, it makes far more sense to create a custom configuration file for each game that needs special settings. This can easily be done simply by copying the default DOSBox settings file, renaming it, editing it as necessary and then starting DOSBox with the edited settings file. In this tutorial we’ll show you how to do that. To follow this tutorial you should have a firm grasp of the concept of file and folder paths or addresses. If necessary, see this tutorial which explains the concept.
If you prefer to watch rather than read, we have created a quick video tutorial to demonstrate the process.
By default, DOSBox stores its configuration files in the current users local application data folder. Configuration files you create can be stored here too if you wish, or you can store them in any folder on your PC. Finding the local application data folder can be tricky since it is a hidden folder. The quickest way to open it is as follows.
1) Open up a File Explorer or Windows Explorer window.
2) Click on the path at the top of the window, that’s the bar at the very top that shows you the path or address of the folder you’re currently viewing.
3) Delete anything in this box and enter the following exactly (without the quotation marks) “
%LOCALAPPDATA%", as shown in the picture below (click on the picture to see a bigger version).
4) Press enter. Your Explorer window should look similar the one shown below (click on the picture to see a bigger version). Rather than seeing “Bucko”, in the path/address bar, you will see your username or nickname.
5) Open the DOSBox folder. You should now see folder contents similar to those shown below.
The file named “dosbox-0.74.conf” is our default DOSBox config. If you are using a different version of DOSBox it will be named appropriately for that version. To create a custom configuration file, the easiest way is to simply copy the default configuration file, then rename it for the game you wish to use it with. Then, simply edit the new file as necessary. If you are following one of our guides, simply make the changes recommended in the guide you are following. In the picture above the user has created a file called “dosbox-0.74-win31.conf” ready to use with Windows 3.1 and DOSBox, which we will cover in a later tutorial.
Running DOSBox with a custom configuration
Having created the custom configuration file, we now need a way of telling DOSBox to read this file, rather than the default one, when we start it up. There are two ways that you might typically do this, the first way is to use a batch file and the second way is to create a new shortcut.
Batch files – A batch file is a file that contains various commands that are run in order. It’s a way of automating various tasks. Say for instance you want to run Xpadder, load a custom controller configuration for your DOS game, then start DOSBox and play a specific game. A batch file is ideal for this kind of automation. The following is taken from a batch file we created for the game “Network Q Rally Championship”.
start C:\Games\XPadder\Xpadder.exe C:\Users\Bucko\Documents\XPadder\Network-Q-Rally.xpadderprofile
"C:\Program Files (x86)\DOSBox-0.74\DOSBox.exe" -conf "%LOCALAPPDATA%\DOSBox\dosbox-0.74-RallyChamp.conf" "C:\DOSBOX-C\RALLYC\RALLY.BAT" -fullscreen -exit
The first line of code starts Xpadder. By prefixing the command with “start”, we can start Xpadder and tell Windows not to wait before carrying on to the next line.
This next line is where the magic happens with DOSBox. The first part between the first set of quotation marks tells Windows to run DOSBox, as you might expect. After that we have a part that says “-conf”. This tells DOSBox, “hey, use the configuration file I specify here”. The next part specifies the configuration file, you need to supply the name of the file and also tell DOSBox where it is stored on your PC. We used the magical %LOCALAPPDATA% variable and then just pointed it to a specially made configuration file.
This next part of the line (“C:\DOSBOX-C\RALLYC\RALLY.BAT”) simply tells DOSBox to automatically start “RALLY.BAT”, taking us directly into our game and saving us the need to do that manually.
Finally, the “-fullscreen” command makes DOSBox start in Fullscreen and the “-exit” command simply tells DOSBox to quit automatically when the game exits.
You can create batch files easily, simply load Notepad, enter the commands you want to use and then save the file with the .bat file extension. If you want to experiment with this, we recommend disabling the “hide file extensions” feature to avoid confusion. If you don’t know what that means, see this tutorial.
We’ll be covering batch files in more detail in a future tutorial, so don’t worry if you didn’t understand everything here.
Shortcuts – If you don’t want to use a batch file, you can create a custom shortcut instead. You can place the shortcut on your desktop or on the Start menu/screen. For this example we’ll use the desktop as it’s easier. If you want to add or edit shortcuts to your Start menu, see these tutorials.
Find the standard DOSBox shortcut on your desktop and make a copy of it. Then, rename it however you like. See the picture below for an example.
Make sure that only your new shorcut is selected then right click on it and choose “Properties”. The window shown below will then appear.
Near the top of the window is a box labelled “Target”. Click on the Target box and then press the “End” key on your keyboard to get to the end of the line. Now, delete “-userconf” and type “-conf” (without the quotation marks). Now simply add the full path to the configuration file, for our example that would be “%LOCALAPPDATA%\DOSBox\dosbox-0.74-RallyChamp.conf”. This time you should include the quotation marks too. Click on “Apply” and then “OK” when you are done editing. If you entered the command correctly, when you run DOSBox from this shortcut it will start using the custom configuration file you specified.
Multiple configuration files
What happens when the new version of DOSBox is released? With the above strategy, you will need to update all of your configuration files if this future DOSBox includes some new settings. One way to potentially avoid this is to use multiple configuration files. Create the per-game configuration file as described above and store it in a convenient location on your PC. Now, edit your newly created configuration file and remove all the settings that haven’t changed from the defaults. So for instance if you aren’t changing the scaling settings for this game, remove that part of the configuration file. Typically there will be just one or two settings left in this file. Note that you must still define sections in this file in order for it to work. A section is defined in square brackets, so for instance if you wanted to override the full-screen setting in your standard DOSBox configuration file, the minimum you would need in your custom configuration file is this:-
Save the file and load it with DOSBox exactly as described above. With this configuration file, the fullscreen setting will override what is in your standard DOSBox configuration file, while any other settings will be loaded from the default configuration file.
That’s really all there is to creating and using custom configuration files. Hopefully this hasn’t been too overwhelming for you. If you’re new to using the command line or understanding file paths some of this information may seem a little complex. Use both the example video and the tutorial here when you are practising. As long as you only write to and edit the files and folders we’ve shown in the tutorial, you can’t harm your PC.