SUBST and Junctions!

Do you find yourself constantly drilling down through Windows Explorer to the same folder? Let’s say that your company’s accounting software creates reports in Excel spreadsheets, and part of your job is to open the reports and add information or “pretty them up”. The accounting software creates the reports in some hideously long path, like C:\Program Files\CompanyName\Accounting\Reports\2007\June. This is hard-wired in to the software and you cannot change it. So you constantly have to open Excel and go to File > Open and click 19 different folders to get to what you need. Wouldn’t it be cool if there was an easier way to get there?

There is! Just open a command-prompt window and type SUBST W: [path], like so:

SUBST W: “C:\Program Files\CompanyName\Accounting\Reports\2007\June”

Windows will then create a W: drive of the path you just typed. So now you only need to go to the W: drive to get to the “June” folder! Pretty cool, huh? Be careful with this though – any files you delete via the mapped drive will bypass the Recycle Bin and will be deleted immediately.

Related to SUBST is the concept of junctions. It’s the Windows version of  sym-links from the Unix operating system. Basically, junctions create “hard shortcuts” to other folders on your system. As far as Windows is concerned, the data still resides at the data’s original location. Lemme give you an example: let’s say you’ve got some old game that is hard-coded to be installed on your C: drive. You don’t have that much space on C:, and would prefer to install it on D: instead. You go ahead and install the game, and then create a junction between the old location and the new one… both Windows and your game will think the files and folders are still on C: when they’re actually on D:. But again, be careful: if you delete a junction using Windows Explorer, it will erase the “destination” files as well. So if you created a junction between C:\Games\OldGame and D:\Games\OldGameMove, and then turn around and delete the C:\Games\OldGame folder, Windows will delete the OldGameMove folder as well. To delete a junction, you need to use the command-line software you used to create the junction in the first place.

Please read all the information provided here before you start playing around with junctions; you can also download the necessary utility from that site too!

One Reply to “SUBST and Junctions!”

  1. The syntax for junction still confuses me to this way. Although SUBST is limited in its use (requiring a drive letter for the first parameter), it makes the concept of junction much easier to comprehend. I always refer to the SUBST syntax to understand how I need to use the JUNCTION command.

Leave a Reply to Sun W Kim Cancel reply

Your email address will not be published. Required fields are marked *

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