I have a directory on another drive that I want to show as a new virtual drive. How can I do that?
3 Answers
Use the subst
command:
subst X: F:\some\folder
There is also a great freeware paid utility called Visual Subst to make things even easier:
2021 Update: that software is no longer freeware, and now costs 20$. The last free version is 1.0.6, which is still available on download websites such as Softonic and Uptodown.
-
1
-
5At the bottom of the application there is a checkbox Apply virtual drives on Windows startup if that's what you're after. You could also use a batch script with subst commands and place it in your startup folder.– user1931Feb 16, 2010 at 4:24
-
1I realize that the option is there, it just doesn't work. probably because I have a space in the folder name (that I cant remove) Feb 16, 2010 at 4:30
-
4Possibly. There is also the startup folder in your start menu you can use. Make a batch script with subst commands in it and quote the paths with spaces. An example of 1 line would be
subst X: "C:\Program Files"
– user1931Feb 16, 2010 at 4:31 -
1Or add it as a run entry in the registry. It gets processed and the subst drive gets added quite early in the boot process then. Oct 1, 2012 at 15:31
I used the registry edit on wikipedia so Windows would automaticaly create the drive when starting (tested on Windows 8.1):
- Run regedit.
- Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
- Add a new String Value with the drive letter as the name
- example:
X:
- example:
- Set the value using one of the following formats (Replace
C:\some\directory
with the folder path):\??\C:\some\directory
\DosDevices\C:\some\directory
\Device\Mup\127.0.0.1\C$\some\directory
- Restart the computer.
Another option is to use a VHD (or use a USB and skip steps 2 - 4):
- Open Disk Management.
- Open the Action menu and select Create VHD and follow the prompts.
- Right click the new VHD (bottom half, right click on the gray section on the left) and click Initialize Disk and press OK.
- Right click the data section of the VHD (bottom half, white and black rectangle with the text "Unallocated"), select New Simple Volume... and follow the prompts.
- Right click the data section of the VHD and select Change Drive Letter and Paths..., click Add..., indicate the folder you want to mount the drive to, and click OK for the two boxes.
See also:
-
Thanks; tested on Windows 7 and it works. Only way I could find to mount a directory that has a path beginning with \Device\Mup\– petehernFeb 23, 2017 at 21:39
-
@petehern Which method was the one that worked for you, the regedit method, or the VHD method? Dec 17, 2017 at 0:37
-
-
is there a way to change the volume label for the registry option? It is confusing that the label of the source drive is used, Mar 11, 2019 at 12:21
-
@vlad_tepesch The volume label can be changed from X to what ever label you want in step 3. Step 4 you specify where the VHD is, so it has to be the source drive.– TrispedMar 14, 2019 at 22:06
Apart from the suggested ways, you could do one more thing. Share the folder and Map as network drive. Here are the steps:
Step 1: Share the required folder. (You can just share with yourself or Admin group)
a.Right Click on the Folder and select Share with specific people
b.Click Share button on the share with dialog.
c.Copy the share path that is generated.
Step 2: Map the network drive
a.Click on Map Network drive in windows explorer
b.Once it launches, use the previously copied path as the network location.
c.Click on finish and you are done. Make sure to click on Reconnect on logon.
Benefit is that you get to see the drive grouped separate from other physical drives.
-
1Note that this requires Network Discovery to be turned on which you may or may not want depending on which network you're connected to.– DarynNov 25, 2019 at 15:22
-
1This solutions has a few drawbacks, but I am grateful you mentioned it since it is a completely different approach.– Kar.maMay 25, 2021 at 12:51