Windows : Map a Path to a Drive letter

Ever wondered if you could assign your favorite directories lying deep under a large chain of directories, as seperate drives?

This post is going to tell you how to refer to a path like “D:\workspace\topcoder\development\javaprojects\” as simply “T:”

First let me tell you the manual way of doing it using the command prompt.

Suppose the path is “D:\workspace\topcoder\development\javaprojects\” and we want it to map to a drive letter say “T:”, then all we need to do is to open the command prompt and type the following command.

subst T: "D:\workspace\topcoder\development\javaprojects\"

Now, instead of typing the full path, you can reach this directory by typing the letter of the virtual drive, followed by a colon, as follows:

T:

You will see that a new drive entry is created under your “My Computer” as “T:” which maps to the desired folder. After doing this we can refer to a path like “D:\workspace\topcoder\development\javaprojects\ProjectABC” as simply “T:\ProjectABC\”

If you want to delete this drive then just issue the following command.

subst T: \d

Points to remember:

  1. This is not a permanent mapping as the mapping will be lost after you restart windows or log off. (You can create a batch file for this and put it on startup to have your drive everytime you log on to windows. Read further to know how to avoid this.)
  2. The commands like chkdsk, diskcomp, diskcopy, fomrat, label and recover, do not work and should not be used on drives created with subst command.
  3. To see more details of the command. Type: subst /?

Now, for the people who hate command line stuffs, there’s a nice little tool available called Visual Subst. It uses the API similar to the console ‘subst’ utility, but makes it easier to create and remove virtual drives in a GUI way. This tool also allows you to persist the virtual drive mapping on windows restart.

Note: This works with Windows 2000/XP as well as Windows Vista platforms.

Extra Note (Added for my own safety) : I am not responsible if anything goes wrong, while trying out the commands or softwares presented here.

6 comments so far

  1. arindam on

    Hey nice post man, but authors name is not visible…

    I can guess who it is but its better to keep the name…

  2. DarK on

    what about mapping a physical partition as a folder and NOT as a drive, i think that is useful too.

  3. Ramnath R Iyer on

    I have been trying to find a way of mapping a folder on Linux to a drive, but have been unsuccessful so far. Can you help me with this?

    *rofl*

  4. himalaya ka maharaja on

    i am quite bored..

  5. himalaya ka maharaja on

    im ur most loyal visitor on this website.. that may or may not be related to the cause that i am highly vella

  6. Garfae on

    @DarK… Mapping a physical partition as a folder can be achieved (under Win2k and WinXP) by going to the Management Console (My Computer -> Manage), Disk Management, right-click on the partition and select “Change drive letter and path…”. You can then define an empty folder which will appear to hold the contents on the partition (instead of a drive letter).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: