8 Ways to Map Local Folder to a Driver Letter on Windows
With hard drives having such huge capacities these days, it’s not unheard of for some people to have millions of files spread across their system. When you have a lot of files it is really important that everything is stored in a well ordered directory structure so files can be found more easily. For the less organized there are tools to quickly search the contents of your drives.
Even if the overall directory structure of your system is efficient there might be several folders you access often that are found several layers down. An easy solution to get quick access to one of these folders is mapping it to a drive letter. This is a simple method and means instead of constantly drilling down through sub folders, just click on the drive in Explorer and you are taken directly there.
Of the 26 drive letters available on your system, probably only a few are in use. That leaves several free letters that could be used for this purpose. Although it’s easy to map a network folder to a drive letter, mapping a local folder to a drive letter is slightly more difficult. Here are some ways to do it.
Using the Windows Subst Command
Windows has included a command to substitute a folder for a drive letter since the days of Windows NT in the early 1990’s. The Subst command is pretty much unchanged in how it works and is still present in the latest versions of Windows 10.
Usage is quite simple, open a Command Prompt (press Start and type cmd). Type Subst and as an argument supply the drive letter you want to map the folder to, then add the full path to the folder.
Subst [Drive:] [Pathtofolder]
A simple example would be:
Subst X: D:\downloads\work\myfiles
Make sure to enclose the folder path in quotes if it contains spaces. Type Subst without arguments to check the mapping has worked as you are not notified if it was successful.
To remove the mapping enter the drive letter and add the /D argument:
SUBST X: /D
Mapping a folder to a drive letter with Subst isn’t permanent and you will lose the association after rebooting or logging off. Therefore, the delete command is only needed to remove the mapping immediately without restarting.
Forcing Subst to Run on Startup
If you want the mapping to work all the time, a simple solution is to run Subst automatically during every boot. This can be done via the registry. It is recommended less experienced users try one of the more automatic solutions before using this.
1. Open Regedit and navigate to the following key:
For the permanent mapping to only affect the currently logged on user, go to:
2. Right click on Run > New > String Value. Give it a name such as “Map X”
3. Double click on the name and for Value data enter the Subst command like above. For example:
Subst X: D:\downloads\work\myfiles
Close Regedit and after you reboot or logon, the Subst mapping will automatically be created.
A Subst GUI Frontend Tool
vSubst is a small, portable tool weighing in at only 18KB in size. The original developer website is now gone but the program is still freely available and perfectly usable. This is a pretty useful frontend GUI for the Subst command.
After launching vSubst, select the desired drive letter to map the folder to, then click Add. A small dialog will popup where you can manually type the path or locate it with the Select button. The new mapping will immediately appear in the substituted folders list. Just highlight an entry and press Remove to delete the drive and free up the letter.
The Persistent button will place an entry for vSubst in the Users Run startup key in the registry, similar to the manual method above. The vSubst executable will be copied to the Windows folder so make sure to run vSubst as administrator or the copy to Windows might fail.
Run Subst From a Batch Script
You can easily make your own batch script with just a couple of lines but this ready made script called Psubst is more Advanced. Its main purpose is to make drives mapped in Subst persistent so they survive a reboot. Use this script from Command Prompt or another script (run as administrator) like you would use Subst.
The arguments are virtually the same as Subst. The only difference is adding /P to the command will make the mapping persistent and it will remain after a reboot. It does this by adding an entry to Dos devices in the registry.
Psubst [Drive:] [Pathtofolder] /P (e.g. Psubst X: D:\downloads\work\myfiles /P)
“Psubst [Drive:] /D /P” will remove a persistent drive, “Psubst /P” will list current persistent drives, and “Psubst [Drive:] /D” will just remove a normal mapped drive. Adding a mapping with /P will only add its entry to the registry which will take effect on the next reboot. To also map the folder immediately you will need to run the same command again but without /P.
Using a program that can convert a batch file into an executable, Psubst can be made into a standard .EXE file. You can do this yourself by using a Bat to Exe tool.
Create a Mapped Folder with a Third Party Tool
Visual Subst is a simple to use tool that allows you to create a number of drive mappings quickly and easily. The program is portable and only 137KB in size. Although it uses the same API as Subst, the mappings created in Visual Subst are not visible when using Subst on the command line.
Select the drive letter from the drop down menu and enter the path to the folder manually or browse for it by pressing the magnifying glass on the right. Then press the Plus button to assign the mapping and it will appear in the main window.
Checking the box at the bottom will silently run Visual Subst during startup to assign the drive letters. Delete the mapped drive with the X button or save any changes to a current mapping with the disc icon.
Map a Folder to a Drive Letter Directly in the Registry
This next method has a couple of advantages over the Subst command. Not only does it add the mapped drive automatically on every boot, the drive letter is associated with the folder before any applications are launched. That means the drive letter can be used by other applications during boot. This option is not recommended for inexperienced users.
1. Open Regedit and navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
This key will associate virtual drive names with paths and it does so very early in the boot process.
2. Right click on DOS Devices > New > String value, enter the drive letter to map the folder to, including the colon.
3. Double click on the drive letter and enter the following as a path:
4. Close the registry editor and reboot the computer as this key is only read during startup. Upon rebooting, the mapping will show in Explorer in the list of hard drives.
If you decide to create a .REG file to add or edit Dos devices, add a second backslash to every backslash in the folder path. It won’t work otherwise. An example .REG file of the above would be:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
Map a Folder via the Windows User Interface
There’s an option to map a network folder to a drive letter in Windows Explorer. It’s not possible to map a local folder in this window by using the browse button because it only displays network locations. However, with creative use of network paths, it’s easy to map a local folder to a drive letter from the Map Network Drive window.
1. In Windows Vista or 7 open Explorer, press Alt and go to Tools > “Map network drive”. In Windows 10 or 8 open Explorer and make sure you are in the Computer tab. Press “Map network drive”.
2. In the Drive box drop down, select the drive letter to assign to the folder.
3. For Folder do not press Browse but Instead enter the following into the text box using your own arguments:
Using just Localhost should be fine for most users. Otherwise, use Computername which is the computer’s name. Find the name in System Properties. Right click Computer/This PC > Properties or press Win+Pause.
For Drive you must use a drive letter in the path and substitute the colon for a dollar sign ($). A couple of examples would be:
or using the computer name:
4. Leave the “Reconnect at sign-in” option checked if you want have the folder mapped to the drive letter every time your computer starts or you log on. Press Finish when done.
To remove the mapped folder simply right click on its drive in Explorer and select Disconnect.
Mapping Folders Using the Windows Net Command
The Net command in Windows is able to view, edit or manage many aspects related to the network. It is even powerful enough to change user account passwords or create/delete user accounts. Here we are using the Net Use command which manages shared resource connections. The syntax is as follows:
Net Use [Driveletter:] \\Localhost\[Drive]$\Pathtofolder
Net Use [Driveletter:] \\Computername\[Drive]$\Pathtofolder
Enter the drive letter you want to map the folder to as Driveletter (including colon). For the path to the folder you can use either Localhost or the Computername like the method above. Make sure to use a dollar sign instead of a colon for Drive.
Although a mapped drive should automatically appear the next time you logon, an extra argument can be added in case it doesn’t. Simply append “/P:yes” to make the drive persistent and force reconnect at logon. Use “/P:No” to force the drive to disconnect at logoff.
To delete the mapping from the command line, simply use:
Net Use [driveletter:] /Delete
Use an asterisk instead of a drive letter to delete all currently mapped drives.
Net Use * /Delete
The Net Use command has an advantage over Subst because it doesn’t constantly try to connect if the folder is not available. Subst will constantly try to connect which can have an adverse effect on system performance.
Hi, Thank you worked fine but the I tried dism /Mount-Image but that did not work when the mountDir was in the new drive
So, when I use subst, the new drive letter shows up in the command prompt. I can access via drive letter there, but it is not showing up in my Windows 10 GUI, I can’t navigate to it to save files or anything like that. Anyone else have that problem?