• ARTICLES
SEARCH

How-To Geek

Map a Drive Letter to a Folder the Easy Way in Windows

Have you ever needed to repeatedly access a folder that is nested deep inside a giant hierarchy of folders? Sure, you can always create a shortcut to that folder, but did you know you can actually assign a drive letter to a folder instead? Today we’ll show you how to do this.

This ability has existed in Windows via the subst command for quite a while, so this will also work for you XP users as well.

Map a Drive Letter the Easy Way

The easiest way to assign a drive letter to a folder is to use a simple utility called Visual Subst, which gives you a nice graphical interface to assign drive letters, but also does something that the command line version can’t… you can set your virtual drives to apply again at startup.

You can download and run the utility without needing to install it, and then simply use the Browse button to select your path, and click the green plus symbol after choosing the drive letter.

image

At this point you should see the drive letter show up in the list. (Note that you can delete it by highlighting and choosing the red X icon, or change the path / letter by using the Save button.

image

If you want to save the drives, you’ll want to select the “Apply virtual drives on Windows startup” option.

Now when you open up your Computer window, you should see the new drive show up in the list.

image

The contents of the new M: drive will actually be the contents of my desktop folder.

Download Visual Subst from ntwind.com

Assign Drive Letters from the Command Prompt

If you are more the keyboard ninja type, or just want to know how to use the command line version, you can use the subst command to map drive letters the same way by using the following syntax:

subst <driveletter> <folder path>

For example, to map the M: drive to my desktop folder I would use the following command:

subst M: c:\users\geek\desktop

If you just want to see which drive letters are assigned, you can use subst without any arguments, as shown here:

image

To delete a drive letter you can use the /D switch instead of a path… for instance, to delete the M: drive that I just created, I would use the following syntax:

subst M: /D

Now when you use the subst command to see the current drives, you’ll see nothing in the list.

image

I’ve found the subst command to be very useful, not just in shortening folder paths but also in one instance where I wanted to delete my second partition… I just reassigned the D: drive letter to point to C: and copied all the data over. That way the application shortcuts still worked without having to reinstall the application.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 11/14/08

Comments (18)

  1. satansoldier

    You can write a quick batch and add a shortcut to the start up.

  2. abhishek

    Quite nice tool, but it shows the free space of the new drive equal to the original drive than the size of the folder on which the new drive points. Is that a bug?

  3. Jean-Francois Messier

    Being a PC user since the early 80′s, I had been using this SUBST command for a long time. There is nothing new about this. And rather than using this GUI, I’d just use the command line.

    And now that I’m away from Windows, I use symlinks instead, under Linux. Linux rocks !!!!!

  4. The Geek

    @Jean-Francois

    You can actually use symlinks in Vista now as well:

    http://www.howtogeek.com/howto/windows-vista/using-symlinks-in-windows-vista/

  5. JonMCC33

    @satansoldier

    Once it is mapped via command prompt then the mapping stays there even after reboot. No need to run a single BAT file at startup over and over. ;-)

    I personally don’t like drive mappings. Would rather use shortcuts to UNC path.

  6. jd2066

    The last time I use used the subst command, it didn’t persist past reboot.
    I would guess the apply on startup command in that program just reruns the subst command on startup.

  7. satansoldier

    My post about a batch at startup was to combat “does something that the command line version can’t… you can set your virtual drives to apply again at startup.”

  8. JonMCC33

    @jd2066

    You’re right, I’m thinking of the NET USE command. Which can work in a similar way. Just share out a folder on your hard drive and map to it with the NET USE command. You can use your own computer name when doing so. It will persist past reboot. ;-)

    http://technet.microsoft.com/en-us/library/bb490717.aspx

  9. consindo

    This program made photoshop loose the path to all it’s photos. It keeped thinking that my photos were on Z drive where my downloads actually were.

  10. MikeMMB

    What happens if you delete the folder (because you don’t need it anymore!)?

  11. marmstro

    If you didn’t want to create a *.cmd or *.bat script file you could also create a shortcut with the following as the “target”/”Location”

    %COMSPEC% /C “SUBST M: D:\MyFolder >NUL 2>&1″

    Note the quotes. Use whatever you like as the shortcut name. After it is created, use the shortcut properties (right-click on the shortcut and select “Properties”) to change the shortcut “Icon” if you want. Also, if you don’t like the “flash” that occurs when you open the shortcut properties and change the box “Run:” to “Minimized”.
    This shortcut will invoke the shell (Windows command processor) and execute the SUBST command. The ” >NUL 2>&1″ throws away any messages that the SUBST command may generate.

    Then you can independently copy/move the shortcut to anywhere (desktop, quick launch, start menu…) and not be tied to the location of a script file. For example, if you placed the shortcut in your “start” folder then the drive would be created every time you login.

    If you REALLY want to get fancy you could create a shortcut “toggle” by using the following as the “location”/”target”

    %COMSPEC% /C “IF exist M:\ ( SUBST M: /D >NUL 2>&1 ) ELSE ( SUBST M: D:\MyFolder >NUL 2>&1 )”

    Every time you double click on the shortcut it will delete “M:” if the drive exists, otherwise it will create it.

  12. marmstro

    I just thought of a RELLY fancy “toggle”. This reports the status of your drive (deleted or dreated). Change your “location”/”target” to:

    %COMSPEC% /C “IF exist M:\ ( SUBST M: /D & ECHO Drive M: deleted & SUBST & pause ) ELSE ( SUBST M: D:\MyFolder & SUBST & pause )”

    Of course, to see the results, your shortcut properties “Run:” window must NOT be set to “Minimized”.

  13. Paul Kilo

    I have found (at least in my system – win xp -) that Subst mess up with the attribution of the drive letter if you insert a removable drive AFTER you issue the subst command.
    Let’s say that your subst target is F:, and the next available drive letter (before subst) is F:: when you plug-in the device, Windows will associate the letter F: to the device but you can’t see the removable drive content beacuse is “hidden” by the SUBST drive letter target. You have to SUBST /D in order to see the removable drive. I have to remember to not target the next free drive letter with subst to circumnavigate the problem.

  14. Patrick

    Paul,
    I have also seen that problem with NET USE or windows sharing drives. It’s a generic bug in XP, simple solution is exactly as you stated, just assign letters to static things further down the alphabet.

  15. jill

    if you are having problems with removable drives changing/hiding other drive designations…. this might help paul kilo

    this is easy, but don’t touch anything else.
    as an administrator click “start”, right-click on “computer, select “manage”, in the left frame – select “disk managment”. (lower right frame) you can assigned specific letters to removable media by right-clicking on “disk #”, select “change letter and paths”, select “add” or “change” and then pick a letter. this removable media will always appear as that and as long as it far away from the other maps then, they shouldn’t conflict. click all the appropriate ‘ok’ and “applies”, then close the manage window.

  16. Alan

    Thats a great tutorial but is there a way to rename the icon in Computer?
    I mean that I mapped a drive letter to a folder within my ‘Documents’ partition and it showed up as ‘Documents’ just with a different drive letter. When I tried to rename it I kept getting an Access Denied error.

  17. Lila

    This was a great article and helped me get the drive set up, however, it keeps telling me the drive is disconnected. How do I fix that?

  18. nishant

    how to remove this created drive if we have created it without using any software and only cmd commands? reply soon…:D

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!