NTFS reparse points (mount points and junction points) can
reduce the amount of time and effort you spend navigating your hard disk. The
most useful of the reparse points feature are junction points, which allow you
to redirect a folder on one hard disk to another folder on the same hard disk
or on a secondary hard disk.

When it comes to creating junction points, the only
Microsoft utility designed for the task—a command-line tool called
Linkd.exe—doesn’t even come with the operating system and isn’t very efficient.
However, I recently discovered an undocumented method in Windows XP for
manually creating junction points without the need for the Linkd.exe utility or
any third-party software. This undocumented method simply involves creating a
specially configured Desktop.ini text file, a standard shortcut, and a few
folder manipulations. Here’s how to create the special Desktop.ini file and how
to use it to quickly and easily create junction points.


Working with NTFS junction points involves traps that are
easy to fall into if you don’t really understand what you’re doing. It’s important to keep in mind that NTFS junction points are
designed to work only on local hard disks. They don’t work across a network. In
other words, you can’t create a junction point on an NTFS drive that points to
a network drive.

Another big trap is that you can indeed delete the folder
acting as the junction point from within Windows Explorer or from the command
line with the Del command. However, rather than just deleting a junction point,
these commands can actually delete the target directory and all subdirectories.
So it’s extremely important that you use the steps in this article when it’s
time to remove or change your junction points.

Furthermore, keep in mind that junction points can cause
havoc with certain utilities, such as backup programs, that aren’t junction-point
aware. You might also notice that the Dir command reports odd free-space
statistics on drives that contain folders acting as junction points.

The CurrentWork file-management technique

In a previous article, I showed you how to use reparse
points along with the CurrentWork technique
. Since this example technique
really helps to bring home the goals achieved by using junction points, it’s
worth taking a moment to briefly recap the CurrentWork file-management

The main advantage of using junction points is to reduce the
amount of time and effort you spend navigating your hard disk in both Windows
Explorer and in your application’s Open and Save As dialog boxes.

Ever since I discovered the benefits of junction points,
I’ve kept a folder named CurrentWork in the root directory of my NTFS drive. As
I begin each new writing assignment, I create a junction point that redirects
the C:\ CurrentWork folder to a folder deeply nested in the folder structure
that I use to keep my work organized. For example, the target folder could have
the path:

C:\Documents and Settings\Greg Shultz\My Documents\My Work\Freelance\TechRepublic\10-October04\JunctionPoints

As I finish an assignment, I remove that junction point and
create a new one for the next assignment. Of course, this means that the target
folder is always changing as I move from assignment to assignment. However,
once I create the new junction point, the only folder name I have to navigate
to when opening, saving, or copying files related to the assignment is the C:\
CurrentWork folder. This has saved me an immeasurable amount of time and

Once you learn how easy it is to create your own junction
points, you can apply this example to the way you work. Chances are good that you,
too, will reap the benefits once you get into the habit.


Now that you have an idea of how the CurrentWork file-management technique works, we’ll use it as an example as we move forward. To
get started, we need to do some prep work that involves creating a CurrentWork
folder, the Desktop.ini file, and two special helper files.

To begin, launch Windows Explorer and create a new folder in
the root directory called CurrentWork. Next, launch Notepad and type the
following text:


Save the file in the CurrentWork
folder as Desktop.ini. By default, Notepad will append the .txt extension
unless you enclose the filename in double quotes in the Save As dialog box.

The Desktop.ini file is a standard text file used to customize
the appearance and behavior of the folder that it contains. In this case, the
commands in Desktop.ini allow the folder to be configured as a junction point.
Let’s take a closer look.

The [.ShellClassInfo] line is a section heading indicating
that the entries and assigned values that fall under the heading will, in this
case, customize the folder’s behavior. The CLSID2 entry is assigned the value
{0AFACED1-E828-11D1-9187-B532F1E9575D}, which points to a registry key that
identifies a special folder shortcut named Target.

While Notepad is still open, press [Ctrl]N to open a new
document. Then, type the following command:

Attrib +s C:\CurrentWork /s /d

Save the file in the root folder as EnableSys.bat. Replace
the plus sign with a minus sign so that the command looks like this:

Attrib -s C:\CurrentWork /s /d

Save the file in the root folder as DisableSys.bat. As you
can see, both of these batch files run the DOS command Attrib, which allows you
to set file and folder attributes. We have to resort to the Attrib command
because Windows Explorer allows you to set only the Read-only and Hidden

In the case of EnableSys.bat, the Attrib command is used to
set the system attribute on the CurrentWork folder. In the case of
DisableSys.bat, the Attrib command is used to remove the system attribute on the
CurrentWork folder.

Creating a junction point

Now that you’ve created and saved the Desktop.ini file in
the CurrentWork folder and the EnableSys.bat and DisableSys.bat files in the
root directory, you’re ready to create your junction point. The first step is
to create a shortcut to the folder you want the junction point to refer to.

The easiest way to create this shortcut is to open the
CurrentWork folder, pull down the File menu, and select the New | Shortcut
command. When you see the Create Shortcut Wizard, click the Browse button and
use the Browse For Folder tool to locate the folder, as shown in Figure A.

Figure A

The Create Shortcut Wizard’s Browse For Folder tool makes it easy to create a shortcut to a folder that is deeply nested in the folder structure.

After you click OK and Next, the wizard will prompt you to
provide a name for the shortcut. Type Target
in the text box, as shown in Figure B, then click Finish. (As you’ll remember, the CLSID2 entry in the
Desktop.ini file points to a key in the registry that identifies a special
folder shortcut named Target.)

Figure B

In order for the manual junction point technique to work, you must name the shortcut Target.

Navigate to the root directory and double-click the
EnableSys.bat file. You’ll momentarily see a Command Prompt window. When the
window disappears, open the CurrentWork folder and you’ll find that you now
have easy access to your Target folder. (Keep in mind that it may take a couple
of seconds for the junction point to take effect.) As Figure C shows, I now have access to C:\Documents and Settings\Greg
Shultz\My Documents\My Work\Freelance\TechRepublic\10-October04\JunctionPoints.

Figure C

As you can see in the Address text box, the CurrentWork folder now provides easy access to the deeply nested Target folder.

Changing the junction point

When it’s time to work in another folder, you’ll need to
change the junction point. First, access the root directory, double-click the
DisableSys.bat file, and open the CurrentWork folder. You’ll now find the
Desktop.ini file and your Target shortcut file. You can either edit the
Target string of the Target shortcut file, as shown in Figure D, or you can delete the Target shortcut file, launch the
Create Shortcut Wizard, and create a new one.

Figure D

One way to change the junction point is to simply edit the Target string in the shortcut properties box.

Straight to the point

Using junction points can save you time and effort by
simplifying the process of navigating your hard disk in both Windows Explorer
and in your application’s Open and Save As dialog boxes. Creating junction
points manually is easy once you know how, and it spares you from having to
install yet another utility in your already overburdened operating system.