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


June 07, 2007

How do I create symbolic links in Windows Vista?

RSS
Subscribe to Windows IT Pro | See More Tips Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

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]

End of Article



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 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...


Related Events Deep Dive into Windows Server 2008 R2 presented by John Savill

7 Ways To Get More From Your SharePoint Deployment Now

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


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