Windows 7: How to Create Symlinks (Symbolic Links)

Posted April 10, 2011 by Rob Rogers in Windows 7

Symbolic links are filesystem objects that point to other filesystem objects such as directories or files. This can be extremely useful if you want to sync application profiles via Dropbox or move the application profile to a more easily accessible location. There are two types of symlinks: soft, which act as a simple redirect or shortcut, and hard, which make it appear that the file or directory exist in the location of the symlink. Hard symlinks make the new location totally transparent to the application.

To create a symlink, you need to use an elevated command prompt. To do this:

1. Click the Start button (Orb).

2. Select All Programs.

3. Select Accessories.

4. Right-click Command Prompt and select Run as administrator.

For an example, lets say that we were tired of running out of space on our primary hard drive, so we went out and bought a big one to use as a secondary drive. After installing the drive, we want to take advantage of the space for our iTunes music. Make sure to shut down iTunes and any other app using the desired directory.

First, we need to move the Music directory, which in my case is located at:
C:\Users\shamanstears\Music\iTunes\iTunes Media\Music

to our secondary drive, which is now drive E. So, once it is finished being moved, is located at E:\Music. Now we need to create the symlink so that iTunes will know where the Music directory is located.

The symlink will be created by using the MKLINK command. By default, MKLINK creates a file symbolic link. This can be changed by using one of the following flags:

/D – Creates a directory symbolic link.
/H – Creates a hard link instead of a symbolic link.
/J – Creates a Directory Junction.

Using the Elevated Command Prompt that was described earlier, we will use the MKLINK command to create the symlink as follows:
mklink /j "C:\Users\shamanstears\Music\iTunes\iTunes Media\Music" e:\Music\

Once that has been completed, we can fire up iTunes and listen to our music without it knowing we moved anything at all.

To remove the symlink and return things to the way they were, close iTunes and any other app that is using the directory. Move your directory back to its original location and delete the symlink shortcut that is located in that location.

Of course this is a simple example, but symlinks can be used for a variety of things. For instance, I use both Corel Photo-Paint and Adobe Photoshop. Instead of copying my plugins to a directory for each application, I use symlinks to point both apps to a single directory. That way I always have access to my plugins from either app with no duplication.


About Rob Rogers

Once a prolific author here on Tech-Recipes, Rob has moved on to greener pastures.
View more articles by Rob Rogers

The Conversation

Follow the reactions below and share your own thoughts.