Questionable Dabbling

An unfocused exploration of ‘How’ and ‘Why’

  • You are here: 
  • Home
  • How to Map a Folder to a Drive Letter

How to Map a Folder to a Drive Letter

Last week, I reformatted my ThinkPad. Usually, I create two partitions for a Windows implementation, one for the OS (C:\) and one for data (E:\). This time around, I did something wrong when executing the restore and now have a single C: drive … Too lazy to rerun the restore process, I decided to make lemonade.

In an effort to utilize the structure implemented by Windows, Program Files are in C:\Program Files, rather than E:\Program Files. Personal data are organized in My Documents and work data are organized in My Work, rather than a custom structure on the E: drive (ok, My Work is a slight deviation). With one exception, things are OK so far.

Here’s the problem. I write a lot of automation scripts for work (meaning I’m on a command line a lot). The command line prompt usually looks something like this beautiful thing:
'C:\Documents and Settings\[me]\My Work\Projects\[projectname]\[subfolder][\subfolder2][\...]‘
Oddly, the GUI world isn’t all that bad… Thanks to Executor there are aliases for my most accessed folders. Really, the only place this is an issue is on the command line.

[Li/U]nux, and by extension, OS X, allow one to create links between files using the ln command. Alas, a similar utility does not exist in Windows land. (truth be told, SysInternals has something similar, but it comes with a few complications.)

Enter SUBST:

Using SUBST, one can create a virtual drive that maps to a folder. Not as powerful as ln, but still very useful.

SUBST P: "C:\Documents and Settings\[me]\My Work\Projects\”

Now all my projects are readily accessible. Less than 10 keystrokes gets me from an empty desktop to any project, on the command line. Taking it a step further, a simple Perl/VBScript/AutoHotKey script will allow me quick access to map specific projects (and SharePoint Folders) to the letters of my choosing. (Two steps further and a startup script maps a couple drives automatically)

It turns out, if you work with it, not against it, Windows is only mostly bad. I’m constantly learning new tips and tricks built into the OS that allow almost as much flexibility as *nix.

Cheers,
Chris

For the GUI inclined, the folks at NT-Wind have a free utility called Visual Subst which does similar.


Posted on September 11th, 2008 | By: Chris | Tags: , ,
Filed under CLI, Windows


4 Responses to “How to Map a Folder to a Drive Letter”

  1. jatimage Says:
    August 26th, 2009 at 7:43 am

    jatimage…

    Madoona Of The Rocks

  2. zapikatok Says:
    September 25th, 2009 at 1:50 pm

    zapikatok…

    latest hex keys for pansat 3500sd

  3. Alex Gordon Says:
    April 8th, 2010 at 4:15 pm

    И что бы мы делали без вашей замечательной фразы…

    Специалист Last week, I reformatted my ThinkPad. Usually, I create two partitions for a Windows implementation, one for the OS (C:\) and one for data (E:\)…..

  4. Kylie Batt Says:
    April 21st, 2010 at 9:02 am

    Дождались…

    Директор по персоналу Last week, I reformatted my ThinkPad. Usually, I create two partitions for a Windows implementation, one for the OS (C:\) and one for data (E:\)…..

Leave a Reply