CyberNotes
Tutorial Thursday


arrow Windows Windows only arrow
On your computer there are probably just a handful of folders that you access everyday, and wouldn’t it be nice to make them even easier to access? One way to do that is to assign your most used folders to drive letters on your Windows machine, which puts them just a click away from your mouse. The good news is that Windows comes with the functionality needed to do this, but it’s buried in the command line.

If you’re new to using the command line in Windows you don’t have anything to worry about… this task will be about as easy as it gets. Being able to have your downloads folder, music, pictures, and more all assigned to different drive letters will definitely make this a well-spent two minutes.

–Assigning a Drive Letter to a Folder–

Note: If you’re familiar with how the command line works in Windows you can probably jump to the Command Prompt screenshot below to get the gist of what this section covers.

Open up the Command Prompt utility in Windows, which can be found in the Start Menu’s Accessories folder. Once the Command Prompt is open you’ll be able to start entering in commands. The format of the command you want to use is:

subst x: "c:\Documents and Settings\Wagner"

In that the “x:” represents the drive letter that you want to assign to the folder. You’ll get an error message if you try to use a drive letter that has already been assigned to another folder or one that is used by the operating system. The “c:\Documents and Settings\Wagner” is the directory on the computer that you want the drive letter to point to. Make sure you place quotes around the path to the folder if it contains spaces, otherwise it will not work.

To see a list of drive letters you’ve already assigned to folders just enter in subst without any other parameters.

To remove a drive letter that you’ve assigned to a folder there are a few different things that you can do. If you don’t feel like diving back into the command line you can just log off or restart your computer. Alternatively this command can be used to remove a drive letter:

subst x: /d

In that command “x:” represents the drive letter you wish to remove, and the “/d” is what tells the computer to remove that drive letter.

Here’s a screenshot of the various different commands being used, and after the screenshot I walk through what each line is doing:

subst command line.png

Here’s what’s going on in the screenshot:

  1. Assigning the Program Files folder to the X drive letter
  2. Assigning the My Documents folder to the Y drive letter
  3. Trying to assign the Windows folder to the Y drive letter, but it fails since I have already used it
  4. Using the subst command to list out the folders I currently have a drive letter assigned to
  5. Remove the X drive letter
  6. Show that the X drive letter has been removed

–Assign Drive Letters at Startup–

The only problem with the above system is that Windows forgets the folders you’ve mapped to drive letters once you log off or restart the computer. Luckily we can easily get around that by placing a customized batch file in your computer’s Startup folder. Here’s what you need to do:

  1. Open up Notepad, and list out each folder you want mapped using the subst command that we explained above. There should be one command per line, and make sure you put quotes around the path to the directory if it contains spaces:
    notepad subst.png
  2. Now save this as a batch file. This can be done by going to File -> Save As, and enter in the name of your file. Make sure your filename ends in .bat:
    notepad save bat.png
  3. [Optional] You can test to make sure your batch file works as expected simply by double-clicking on it. The folders should be assigned the drive letters you specified in the batch file.
  4. Move the batch file you just created in the Start Menu -> Startup folder so that it runs each time your computer starts up.

–Overview–

That’s all there is to assigning drive letters to your favorite folders. It might seem a little complicated, but I wanted to be sure that you understood how everything works. If you’re still a little overwhelmed you can use a free app called Visual Subst that does essentially the same thing. The down side to the app is that it needs to run whenever your computer starts in order to assign the driver letters to the folders. So for the sake of performance I use the batch file method that I walked you through above.

  1. An easier way, share a folder, and then map a network drive to that folder. I’ve only briefly tested it but it should work and no batch file or anything needed.

  2. Take a look at the following free software, it is fully compatible with subst!

    Visual Subst – virtual drives in effect – NTWind Software
    [ntwind.com]

  3. Jean-Francois MessierJuly 3, 2008 at 10:12 am

    This SUBST program is something I was using looooooooong time ago, back in the 90’s, when only MSDOS and command-line (no Windows or mouse !) was available and hard disks size was measured in MEGAbytes, not GIGAbytes. My main use of this was to add more directories to the PATH environment variable, which was limited to 256 characters. Using a drive letter was way shorter than a complete path. So I could cram more locations in this PATH. But this is nothing new, except perhaps for those who were born with a mouse.

    JF

  4. Gianni wrote:
    Take a look at the following free software, it is fully compatible with subst!

    Visual Subst – virtual drives in effect – NTWind Software
    [ntwind.com]

    We mentioned that in our overview at the end of the article, but there’s no need to have a full application always running to do something like this. That’s why we wanted to put together the tutorial.

    Jean-Francois Messier wrote:
    This SUBST program is something I was using looooooooong time ago, back in the 90’s, when only MSDOS and command-line (no Windows or mouse !) was available and hard disks size was measured in MEGAbytes, not GIGAbytes. My main use of this was to add more directories to the PATH environment variable, which was limited to 256 characters. Using a drive letter was way shorter than a complete path. So I could cram more locations in this PATH. But this is nothing new, except perhaps for those who were born with a mouse.

    I’ve been using it for a long time as well, but I asked around before writing the article and there were quite a few people who had never heard of it. Of course you really have to be familiar with the command line to know things like this.

  5. The down side to the app is that it needs to run whenever your computer starts in order to assign the driver letters to the folders.
    The BAT file also needs to run at startup..

    Ryan wrote:
    We mentioned that in our overview at the end of the article, but there’s no need to have a full application always running to do something like this..

    No, it just sets up the configured drives at startup and exits (just like the batch file)

  6. x wrote:
    Ryan wrote:
    We mentioned that in our overview at the end of the article, but there’s no need to have a full application always running to do something like this..

    No, it just sets up the configured drives at startup and exits (just like the batch file)

    Ahh, I didn’t realize it exited immediately after configuration. That’s not so bad then.

  7. Great tip! I haven’t used SUBST in a long, long time! One strange thing is happening. I have the BAT file in my Startup folder and the new drive letters show up in any application’s Open or Save dialogs BUT it doesn’t show up in Windows Explorer all the time. Any ideas why?

  8. Brian wrote:
    Great tip! I haven’t used SUBST in a long, long time! One strange thing is happening. I have the BAT file in my Startup folder and the new drive letters show up in any application’s Open or Save dialogs BUT it doesn’t show up in Windows Explorer all the time. Any ideas why?

    Huh, that didn’t happen to me at all. Do you know if you can get a mapped network drive to show up?

  9. Ryan wrote:
    Brian wrote:
    Great tip! I haven’t used SUBST in a long, long time! One strange thing is happening. I have the BAT file in my Startup folder and the new drive letters show up in any application’s Open or Save dialogs BUT it doesn’t show up in Windows Explorer all the time. Any ideas why?

    Huh, that didn’t happen to me at all. Do you know if you can get a mapped network drive to show up?

    Thanks for replying! Yep, I can see all mapped network drives in both views (from within an application and from within Windows Explorer).

  10. Brian wrote:
    Yep, I can see all mapped network drives in both views (from within an application and from within Windows Explorer).

    That’s interesting. The drive showed up in Windows Explorer almost immediately after creating it. I didn’t even have to close Windows Explorer to see the changes. Must just be some sort of bug. Sorry I couldn’t help ya.

  11. Very informative article. Thank you!

    In my search for a solution like this I came across another neat approach which doesn’t involve any batch file or executable (only installation program that tweaks something in the system and never needs to be run again). I don’t know how they do that:

    [softwarecandy.com]

    Out of curiosity, with the 50% automatic discount when creating a new account and the low price for this little utility (I paid only $1.50) I actually downloaded it and was impressed by the original approach.

    It worked for me on Windows XP and Windows 7 (don’t know about Vista. I skipped Vista).

    Mark