Skip navigation

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\]
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish