Internet Security Blog - Hackology

Map a Drive Letter to a Folder 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? And we’l do that below …

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. – May seem dumb as why should we but hey read the title of Blog 

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.

 

Add comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get Wise

Subscribe to my newsletter to get latest InfoSec / Hacking News (1 Email/week)
Utopia p2p Ecosystem