How-To Geek: Using Symlinks in Windows Vista

I haven’t tried using my favorite XP junction tool, NTFS-Link, since I upgraded my home computer to Windows Vista, and I’m a little apprehensive since the filesystem has changed a bit. Nonetheless, if you are still using XP, NTFS-Link is an excellent tool for those of you already familiar with symbolic links via other operating systems, such as Linux.

Luckily, Windows Vista does include a command-line tool for creating symbolic links, similar to “ln” in Linux. However, it’s not quite as straightforward. Here’s the scoop from How-To Geek:

Using the mklink Command

The command that you need to use is mklink, which you’ll use from the command line. Just type it on the command line to see the options:

C:Usersgeek>mklink
Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link

(continued via Using Symlinks in Windows Vista)

Hard Link vs. Symbolic Link

In reference to the last article I posted about NTFS Junction Points, here’s some more related information:

Hard link – Wikipedia, the free encyclopedia

In computing, a hard link is a reference, or pointer, to physical data on a storage volume. On most file systems, all named files are hard links. The name associated with the file is simply a label that refers the operating system to the actual data. As such, more than one name can be associated with the same data. Though called by different names, any changes made will affect the actual data, regardless of how the file is called at a later time. Hard links can only refer to data that exists on the same file system.On Unix-like systems, hard links can be created with the link() system call, or the ln utility.On Microsoft Windows, hard links can be created only on NTFS volumes, either with fsutil hardlink or mklink. Also, the Cygwin set of utilities has a Unix-like ln command.The process of unlinking disassociates a name from the data
on the volume without destroying the associated data. The data is still accessible as long as at least one link that points to it still exists. When the last link is removed, the space is considered free. A process ambiguously called undeleting allows the recreation of links to data that is no longer associated with a name. However, this process is not available on all systems and is often not reliable.

NTFS symbolic link – Wikipedia, the free encyclopedia

An NTFS symbolic link (symlink) is a file-system object in the NTFS filesystem that points to another file system object. The object being pointed to is called the target. Symbolic links
should be transparent to users; the links appear as normal files or directories, and can be acted upon by the user or application in exactly the same manner. Symbolic links are designed to aid in migration and application compatibility with POSIX operating systems.Unlike an NTFS junction point, a symbolic link can also point to a file or remote SMB network path. Additionally, the NTFS symbolic link implementation provides full support for cross-filesystem links. However, the functionality enabling cross-host symbolic links requires that the remote system also support them, which effectively limits their support to Windows Vista and later Windows operating systems.

NTFS junction point – Wikipedia, the free encyclopedia

NTFS junction point – Wikipedia, the free encyclopedia:

An NTFS junction point (JP) is a feature of the NTFS file system version 3.0 or later. It is a type of NTFS reparse point. Junction Points can be used in a similar way to symbolic links — allowing the creation of a link to a folder that is, for most intents and purposes, the same as the folder itself. This has many benefits over a Windows shell shortcut (.lnk) file, such as allowing access  to files within the folder via Windows Explorer, the Command Prompt, etc. Junction points can only link to directories, and moreover, local directories only; junction points to remote shares are unsupported.[1] For linking to files, possible alternatives to junction points (aside from shortcuts) include hard links (which have the restriction that the file must belong to the same logical volume), and symbolic links (which are only included in Windows Vista and newer, but do work over network shares). The Windows 2000 and XP Resource Kits include a program called linkd to create junction points; a more powerful one named Junction was distributed by SysinternalsMark Russinovich.[1]

While I’m still limited to using NTFS Junction Points (versus Symbolic Links, available in Windows Vista), I do really like the idea of having C:\Users\ link to C:\Documents and Settings\ (who the hell came up with that naming convention anyway?) – similar to how C:\Documents and Settings\ is a symbolic link to C:\Users\ in Windows Vista.

Luckily, there is a utility for just that purpose, available here:

http://sourceforge.net/projects/ntfslinkext/

(more info, including earlier code and screenshots here: http://elsdoerfer.name/=ntfslink)