Map a Drive Letter to a Local Folder

February 7th, 2009

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.

Please use the trackback link when linking to this post.

Related Posts:

Add to Technorati Favorites

2 Responses to “Map a Drive Letter to a Local Folder”

  1. Byron Says:

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

  2. Around_Here Says:

    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.

Leave a Reply

.htaccess Apache article articles by Nilpo ASP ASP Free automation clipboard copy desktop Dev Shed docx Internet Explorer message box Microsoft PHP registry remove script scripting text tutorial tweak tweets Twitter UAC updates User Account Control VBS VBScript vista volume Windows Windows 7 Windows Guru Windows Script Windows Script Host Windows Scripting Windows Vista Windows XP Word WScript wscript.exe WSH XP