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.
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.
Contents |
[edit] Restrictions
The default security settings in Windows Vista disallow non-elevated administrators and all non-administrators from creating symbolic links. This behavior can be changed in the Local Security Policy management console. It can be worked around by starting cmd.exe with Run as administrator option or the runas
command.
[edit] Syntax
The mklink
command is used to create a symbolic link. It has the following command line syntax:
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] Examples
This article or section contains instructions, advice, or how-to content. The purpose of Wikipedia is to present facts, not to teach subject matter. Please help improve this article by removing or rewriting the how-to content, which may qualify for a move to http://www.wikihow.com/ or http://howto.wikia.com/. |
These examples are copied from a MSDN blog post demonstrating the use of the mklink
command line utility for creating symbolic links and directory junctions.
[edit] Creating symbolic links
- 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
- 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 symbolic links
- 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
- 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] External links
- Documentation for NTFS symbolic links on MSDN
- CreateSymbolicLink function in the Win32 API
- Link Shell Extension, which presents a graphical interface for creating hard and symbolic links as well as directory junctions