Map a Drive Letter to a Local Folder

Have you ever had a frequently used folder such as a web root or download folder that you had to navigate to on a regular basis and wished you could just access using a drive letter? Did you know that it is very possible and quite easy to map a drive letter to a local folder? Let the Windows Guru show you how to have this up and running in under thirty seconds!

On my system I have several folders that I navigate to on a regular basis. Some store development projects, others are web roots for testing web applications, and other document or music folders. Have to constantly navigate and remember long paths is both tedious and a nuisance.

It’s widely known that Linux and Unix systems have offered symbolic links to alleviate this. In fact, the usage is extremely common on those systems. What you may not know is that Windows has long since offered scarcely publicized solution as well called Virtual Directories.

In Windows, virtual directories allow you to access local folders using drive letters as if they were local disks instead. The process is quite comparable to mapped network paths.

You’ll need to use the command line to set up your virtual directory so head over to the start button and choose Run.. to open the Run… dialog box. Now type cmd and press Enter to launch a Command Prompt window.

The command for creating virtual directories is subst and the syntax is very simple. It accepts two parameters: the first is the available drive letter to be mapped and the second is the full path to the folder you wish to create a virtual directory for. So if you wanted to map drive W: to your local IIS web root, you would use a command like this:

subst W: C:\inetpub\wwwroot

It’s as simple as that! You can now access your IIS web root by simply opening the W: drive. This setting is persistent which means that your drive letter will remain mapped through reboots until you explicitly remove it.

A couple of things to keep in mind: Do not provide a trailing slash on your folder path. Subst will incorrectly return a path not found error. (Or at least has been my experience on Windows XP systems). You should also remember to enclose your path in quotes if it contains and spaces.

Tags

Like the read? Share it!

4 Comments

  • Thank you soo much!!! Worked a treat with my Vista!

  • Thanks for this post. I might just add, that for Windows 7 at least, the path is case sensitive. If you are getting a ‘Path not found’ error, it is most likely because there is either a slash (‘\’) at the end of your path, or the upper or lower case of directory names in your path name are not correct.

  • Works very well. However, with Windows 7 it disappears with a reboot and I need to go through the process again. Not that difficult but how can I get it to stick? Thanks!

  • Hi, Brian. Thanks for stopping by. The subst command only makes session changes that will not persist across reboots. In order to make the change permanent, you should add a startup registry entry with your command.

    Open Registry Editor and navigate to:

    HKLM\Sofware\Microsoft\Windows\CurrentVersion\Run

    and add a string value. Give it any name you like and paste your subst command for its value. Now your drive letter will be recreated each time Windows starts.

    Bonus tip: If you only want the drive letter available to a single user, look under the HKCU hive instead!

Leave a Reply

Contact

Wanna say hello?
Drop us a line!

You'll find us here

1 Microsoft Way,
Redmond,
WA 98052, United States