Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


Return to article

How do I create symbolic links in Windows Vista?
 

A. Windows Server 2008 and Windows Vista provide the Mklink utility, which creates both file and directory symbolic links. The command has three optional parameters: /D creates a directory symbolic link instead of the default file symbolic link, /H creates a hard link instead of a symbolic link, and /J creates a directory junction.

Suppose you have calc.exe in the windows\system32 folder, and you want to run it as addup.exe instead. You can use the command

mklink addup.exe calc.exe
symbolic link created for addup.exe <<===>> calc.exe
C:\Windows\System32>dir addup.exe
Volume in drive C has no label.
Volume Serial Number is E0BA-564B
Directory of C:\Windows\System32
05/17/2007 11:08 AM addup.exe [calc.exe]
1 File(s) 0 bytes
0 Dir(s) 235,354,234,880 bytes free

Notice that the directory entry shows a symbolic link with the real file name in square brackets. Using /H instead and creating a hard link makes the entry appear as if it's actually the file instead of looking like a shortcut, which is what you get by default. For example, in the output below, you see a standard symbolic link and then a hard link, which appears exactly like a normal file:

mklink /H addup2.exe calc.exe
Hardlink created for addup2.exe <<===>> calc.exe

dir
05/17/2007 11:10 AM addup.exe [calc.exe]
11/02/2006 10:00 AM 188,416 addup2.exe
11/02/2006 10:00 AM 188,416 calc.exe

For folders, you essentially have the same symbolic link and hard link options, and with folders a hard link is known as a junction point, created with the /D and /J switches respectively. With either type of link, you can navigate the folders, and any added/deleted content will update the target folder:

mklink /d testlnk test1
symbolic link created for testlnk <<===>> test1

mklink /j testlnkhd test1
Junction created for testlnkhd <<===>> test1

dir
05/17/2007 11:20 AM

test1
05/17/2007 11:21 AM testlnk [test1]
05/17/2007 11:21 AM testlnkhd [D:\temp\test1]





Reader Comments

Does mklink on Vista replace the old linkd in XP? I can see a lot of overlap, and that linkd is not available on Vista.

bfreund -June 21, 2007
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement