Setting up a mapped drive is great, it gives you a handy shortcut to a particular folder and a really short path when you want to refer to that folder.
You can accomplish this with a Network Drive but (I believe) this could route traffic to the network adaptor before it goes back to the actual folder you want to get to. [investigation required to prove this…]
You can also “subst” a drive, which I much prefer, as it’s definitely a local only thing. It can also be accomplished very quickly and easily from a command line.
For example, if you wanted a mapped drive “W” to point to a a folder “D:\Work” you could do it thus:
subst w: d:\work
subst used to work absolutely fine until windows 7 (possibly even XP I think) when it stopped persisting across reboots.
Now you could add the subst command to a batch file and launch that on windows startup but a, that’s not very elegant and b, the start up commands happen too late if you want to launch a service using something in the subst’d drive.
It’s a simple solution really. You need to add a registry key detailing the drive letter and the folder you want to map it to.
So, sticking with the example above, open up regedit and navigate to either of the following HKEY roots depending on your requirements:
- HKEY_LOCAL_MACHINE (if you want the drive to be set up for all users)
- HKEY_CURRENT_USER (if you want the drive to be set up for only the current user)
Then go to the following path:
<HKEY root>\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
From there add a new string value, setting the name to the drive you want to create (“W:” in our case) and the value data to the following:
The string value should end up looking like this:
If you want to add this using a reg file then you’ll need to escape the backslashes with an extra backslash, like this:
REGEDIT4 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices] "W:"="\\??\\C:\\Work"
You’ll need to do a reboot before the new drive mapping will take effect