Setting Symbolic Links in Windows Vista

February 8, 2007 · Filed Under Windows Vista 

For years *nix systems have enjoyed the ability to point a symbolic link to a file at another location making life a little easier for adminstrators and developers who create scripts. With the Windows 2000 platform there was a step forward with the ability to make directory links or junctions. Now with Windows Vista you can create links to specific target files. This post will discuss this a little farther.

To create a symbolic link you can do this in a command prompt using the MKLINK command which can be seen in this screen shot:

Symbolic Links Syntax

This command has many uses but for this demonstration I am just going to create a shortcut to the calculator on the desktop. While there are other ways to do this, it is just a very simple example.

It is important to know that to create a symbolic link the account you are using needs to have the new privilege Create Symbolic Link that is only assigned to the Administrator by default. For our example I will be running the command prompt with the Administrator account.

Ok so now that we have the command prompt running under Administrator account I want to get to the desktop so I can create the symbolic link:
cd C:\users\vista knowledgebase\desktop

Change directory command for symbolic links

Next I will run the command to create the symbolic link:
mklink calculator.exe C:\windows\system32\calc.exe

Executing our symbolic link command

As you can see the command ouput that the link was created and on the desktop to the left of the command window you can see the icon was created.

You can always tell a symbolic link by a simple dir command:

Symlink directory example

As you can tell from the screenshot the symbolic link is identified as

Windows Explorer is also symbolic link aware and you will see the shortcut arrow and if you enable the link target column you can see the target location:

Symbolic links in windows explorer

Very simple and easy! Now you might be asking why this is useful as you could have easily done that through the GUI. If you are writing scripts or using the built in IIS you will find numerous uses for this helpful command as you can make symbolic links to both local and remote locations. Note that if you do make a link to a remote location the command is run locally.

No Related Posts Found

Comments

One Response to “Setting Symbolic Links in Windows Vista”

  1. Petar Smilajkov on February 18th, 2007 10:19 am

    This is a great post!

Leave a Reply