MKLink (Vista/Windows 7/2008)

Create a symbolic link to a directory or a file, or create a hard file link or directory junction.

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

Key:

   /D     Create a Directory symbolic link. (default is file)

   /H     Create a hard link instead of a symbolic link.

   /J     Create a Directory Junction.

   Link   The new symbolic link name.

   Target The path (relative or absolute) that the new link refers to.

By default, only Administrators can create symbolic links. The security setting 'Create symbolic links' can be granted at: Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment\

Types of Link

Symbolic links are transparent to users; the links appear as normal NTFS files or directories, and can be acted upon by the user or application in exactly the same manner. Symbolic links can span volumes and can use UNC paths.

A symlink can be an absolute path C:\Programs or a path relative to the link's location \Programs.
Symbolic links can expose security vulnerabilities in applications that aren't designed to handle them.

Symbolic Links and Directory Junctions are implemented using reparse points.

Hard Links are implemented with multiple file table entries that point to the same inode – the same as Unix hard links. If the original filename is deleted, the hard link will still work - it points directly to the data on disk.

To create hard links on Windows XP use fsutil.

It is possible (but not advisable) to create two links that point to each other in a loop, or a link that targets itself.

Examples:

Link for a file:
C:\> MKlink ss64.exe C:\Windows\system32\notepad.exe
C:\> Dir
C:\> Del ss64.exe

Link for a folder:
C:\> MKlink /D Apr C:\work\April
C:\> Dir
C:\> RD Apr

MKLINK is an internal command.

"And so its my assumption, I’m really up the junction" ~ Squeeze

Related Commands:

FSUTIL - Create Hard Junction Link
FSUTIL behavior set symlinkevalution - Allow/disable symbolic links
MOUNTVOL - Manage a volume mount point
Q205524 - How to create and manipulate NTFS junction points
LinkD - Create symbolic link (2003 Resource Kit)
Hard Links and Junctions - MSDN
NTFS_symbolic_link - Wikipedia
Junction - Create directory symbolic link (sysInternals)


© Copyright SS64.com 1999-2013
Some rights reserved