With the size of hard drives these days reaching 3 or 4 Terabytes, it becomes very important that while organizing your data on any large drives, the directory structure is well laid out and easy for you to navigate. This can lead to its own problems though of folders you might use quite often being buried several layers down and it’s frustrating searching through loads of sub folders to get access to them.
As you probably know, Windows has 26 drive letters available to the system from A – Z, but most of the time a lot of computers use maybe 4 or 5 of these at the most. Windows has a built in option that allows you to quickly map a network folder to a drive letter for easy access in just a few clicks, but it doesn’t have a similar option to map a local folder to a drive letter in the same quick and easy way.
The good news is the function is there but has been rather hidden away in the form of a DOS command. Windows will allow you to define any drive letter that is not currently in use to represent a physical drive as a virtual drive. Here’s how to map local directories on your system to drive letter.
Using a DOS Command
There is a very old DOS command SUBST, which is short for substitute that allows you to substitute a folder on your computer for a currently unused drive letter. SUBST has surprisingly been available since MS-DOS 3.1 and it’s even still present and works the same way in the latest versions of Windows including Windows 8.
Using the tool is actually very easy. Let’s say for example you frequently need to access a folder called Data in the path C:\apps\files\raymond\cc\blog\ and you want to map it to the X: drive letter which is free. The command to use in Command Prompt is SUBST [drive] [folder].
SUBST X: C:\apps\files\raymond\cc\blog\data
If you want to find out what drive letters are currently assigned to folders, just type SUBST on a line by itself. If you want to remove the association just enter the drive letter to remove and the /D command:
SUBST X: /D
Alternatively restarting your computer will remove the association, which in itself is a drawback of using the SUBST tool because it can’t by itself make the substitute command permanent across reboots. There are however, ways to get around this and keep the drive and folder associated after a reboot. The first is to create a small batch file with the SUBST command and place it in your start folder.
Another way is to use a small batch file created for the purpose of making the virtual drive persistent across reboots. psubst also has an advantage of making the assignment on reboot earlier than when the Run or RunOnce entries are processed which means if the system needs it to run services etc, the letter is already available and assigned.
Because it uses the Windows SUBST command, usage is the same apart from the addition of another argument. Appending /P to the command line will make it persistent and will remain after a reboot.
PSUBST X: C:\apps\files\raymond\cc\blog\data /P
PSUBST [drive] /D /P will remove the drive from the registry and PSUBST /P will show a list of assigned persistent drive letters. You must reboot for the changes to take effect and make sure to run the psubst batch file as Administrator. To make the virtual drive available now, you need to also run the same command again but without the /P argument.
Assign a Drive Letter Using a GUI Interface
If you’re not a lover of using the Command Prompt, here’s an even easier method and it’s all pretty much point and click. Just download the free, small and portable Virtual Subst utility that allows you to associate the most accessed directories with virtual drives all from the comfort of a nice user interface.
Just select the drive letter you want it to map from the drop down, then click the magnifying glass icon on the right to browse for the folder that you want to map and then click the plus icon. The list of what is associated will show in the main area, and to delete the drive letter simply click on an entry and press the red X.
Something we mentioned above is the SUBST command cannot by itself keep the drive letter associated after a reboot, Visual Subst can help with that and ticking the box in the window will run the program on boot and reassign the drive letters that have been saved into the program. To make sure this works, either install the Visual Subst program or keep the portable files in a static location. Works on Windows 2000 and above.
Another tool to perform a drive letter to folder association is the tiny (20KB) and portable vSubst. This tool is more of a front end to the Windows SUBST command and operates in the same way using the same command line arguments.
Usage is again very easy, click on a drive letter and then Add to bring up a window where you can browse for the folder you want tied to the drive letter. It will then show up in the window and be associated. Highlight a substituted folder and press the Persistent button to place an entry in the Users Run startup key in the registry, vSubst will need to be placed in the Windows path. Another useful option in the persistent dialog window is the ability to disable Autorun for all drives so you don’t get a possible popup when associating any drive letters.