Symlinks in Windows

A:\File\by\Any\Other\Name would smell as sweet… Symbolic links have been a *NIX staple since the earliest iterations. Windows finally began supporting the concept with NTFS5, introduced in Windows NT4SP4 and included with Windows 2000. Unfortunately Windows built-in toolset is somewhat lacking, and there are a few gotchas.

Hard Link

A hard link is a file system level shortcut. For all intents and purposes, a hard link is no different from any other file. Each hard link, including the original file name is a reference to a single set of underlying data. Edit one file and all of it’s hard links instantly reflect the change – likewise, the data remains available until the last remaining hard link is deleted. Hard linking is available for files but not directories. Windows XP and above include the command line utility fsutil, whose usage is straightforward

fsutil hardlink create c:new.txt c:existingfile.txt

After this command, c:\new.txt and c:\existing\file.txt are conjoined – changes made to new.txt are instantaneously reflected in file.txt, and new.txt remains in tact if file.txt is deleted.

Soft Link

The Windows-centric term is junction point, but the terms are interchangeable. While a hard link points directly to raw blocks on a disk, a junction point refers to a file name. As such, the junction point does not keep up if the underlying file name changes. The feature is implemented by a file system filter, which transparently redirects I/O as directed by a chunk of data attached to the file. Windows supports junctions only for folders.

Unfortunately, the OS doesn’t include any mechanism to create them. You can use a command-line tool like Sysinternals’ Junction:

junction c:newdir x:anexistingdir

After this command, c:\new\dir will be transparently routed to x:\an\existing\dir. Deleting c:\new\dir\file.txt is synonymous with deleting x:\an\existing\dir\file.txt.

Microsoft’s fsutil can view junction points, but it cannot create them:

fsutil reparsepoint query c:newdir

As with a *NIX soft link, be aware that any actions you take underneath the junction point directly affect the contained files. It is safe to delete the junction point itself, but be careful not to SHIFT-delete a junction point or it’s parents – this will delete the files in the actual directory. Ironically, deletes using the Recycle Bin or rmdir /s do not recurse into junction points.


When looking for a GUI, I came across Link Shell Extension via Greg’s Cool [Utility] of the day. This handy utility adds a chain icon to junction points in Explorer, and allows for the creation of both hard links and junction points. The stateful context menu uses familiar copy-and-paste semantics.

Update: I just installed NTFS Links. This utility adds “Create Soft Link Here” to a drag-and-drop with the alternate button, hooks Windows copy-and-paste with a dialogue box prompting to paste a soft/hard link, and more. Neat stuff!

Be Sociable, Share!

Tags: , ,

3 Responses to “Symlinks in Windows”

  1. JonnyRo says:

    I’m still looking for a good way to back up windows laptops. Got any reccomendations?

    For right now we’re just using NTBackup with the scheduled tasks wizard to accomplish this, but it’s far from optimal.

    I wish there was an rsync implementation for windows that could use the volume shadow copy service API. Then I could have a backup util rsync to the backup server.

  2. Hi, there is a neat solution around.
    The German magazin c’t published a script for it:

  3. twittere search

    Symlinks in Windows « Nathan's Blog

Leave a Reply

Are you human? Answer this: *