NTFS symbolic link

From 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, but there are important limitations in its implementation[1].

Unlike a NTFS junction point, a symbolic link can point to a file or UNC, as well as a folder or a volume, and it can also span file systems.

Contents

[edit] Restrictions

By default only administrators can create symbolic links. You can override the decision using secpol.msc.

[edit] Examples of use

These examples from an MSDN blog[2] demonstrate the use of the new 'mklink' utility in Microsoft Vista.

[edit] Verifying running Windows Vista

C:\test>ver
Microsoft Windows [Version 6.0.5365]

[edit] Description of 'mklink' command

C:\test>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 refers to.

[edit] Creating a symbolic link to a file

C:\test>mklink foo c:\Windows\system32\notepad.exe
symbolic link created for foo <<===>> c:\Windows\system32\notepad.exe
C:\test>dir
Volume in drive C has no label.
Volume Serial Number is 2211-7428

Directory of C:\test
04/14/2006 11:24 AM <DIR> . 04/14/2006 11:24 AM <DIR> .. 04/14/2006 11:24 AM <SYMLINK> foo [c:\Windows\system32\notepad.exe] 1 File(s) 0 bytes 2 Dir(s) 69,238,722,560 bytes free

[edit] Creating a symbolic link to a directory

C:\test>mklink /d bar c:\windows
symbolic link created for bar <<===>> c:\windows
C:\test>dir
Volume in drive C has no label.
Volume Serial Number is 2211-7428

Directory of C:\test
04/14/2006 11:24 AM <DIR> . 04/14/2006 11:24 AM <DIR> .. 04/14/2006 11:24 AM <SYMLINKD> bar [c:\windows] 04/14/2006 11:24 AM <SYMLINK> foo [c:\Windows\system32\notepad.exe] 1 File(s) 0 bytes 3 Dir(s) 69,238,722,560 bytes free

[edit] Deleting a symbolic link to a file

C:\test>del foo

C:\test>dir
Volume in drive C has no label.
Volume Serial Number is 2211-7428

Directory of C:\test
04/14/2006 11:24 AM <DIR> . 04/14/2006 11:24 AM <DIR> .. 04/14/2006 11:24 AM <SYMLINKD> bar [c:\windows] 0 File(s) 0 bytes 3 Dir(s) 69,238,722,560 bytes free

[edit] Deleting a symbolic link to a directory

C:\test>rmdir bar

C:\test>dir
Volume in drive C has no label.
Volume Serial Number is 2211-7428

Directory of C:\test
04/14/2006 11:24 AM <DIR> . 04/14/2006 11:24 AM <DIR> .. 0 File(s) 0 bytes 2 Dir(s) 69,238,722,560 bytes free

[edit] References

  1. ^ Vista Symlinks Revisited…
  2. ^ Symbolic links in Windows Vista.

[edit] External links

[edit] Informative

[edit] Other

  • Hardlink Shell Extension – adds new entries for managing hardlinks, junctions, and symbolic links into the Windows Explorer context menus
  • Link/Junction Creation tool - symbolic link access driver for 2000/XP and symbolic link (Vista compatible) creation tool on 2000/XP.(Japanese)