Share via


Symbolic link in Windows Vista

You can create symbolic link in Windows Vista now.

C:\test>ver

Microsoft Windows [Version 6.0.5365]

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.

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

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

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

C:\test>rd 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

(By default only administrators can create symbolic link. You can override the decision using secpol.msc.)

Documentation of symbolic link can be found in MSDN

https://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/symbolic_links.asp

Comments