technology and zen of life

“A heisenbug (named after the Heisenberg Uncertainty Principle) is a computer bug that disappears or alters its characteristics when an attempt is made to study it.”

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.

Leave a Reply

7 Responses

  1. Jason says:

    Also works in Windows 7. Every time I set up a new machine, I try the Subst from a batch file and get a cmd dialog with the command repeating itself with no results.

  2. Garfae says:

    @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).

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

  4. 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*

  5. DarK says:

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

  6. arindam says:

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

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

Email Subscription

Disclaimer

The views expressed on this blog are personal. We do not claim to be a representative voice of the views of any organisation whatsoever. We are not responsible for the content present on the blogs to which we have linked.Views expressed are solely that of the author and does not reflect a collective opinion of contributors.
%d bloggers like this: