symlinks with Win7

In Windows 7/Vista

In Windows Vista and 7, we’ll use the mklink command to create symbolic links.  To use it, we have to open an administrator Command Prompt.  Enter “command” in your start menu search, right-click on Command Prompt, and select “Run as administrator”.

To create a symbolic link, we need to enter the following in command prompt:

mklink /prefix link_path file/folder_path

First, choose the correct prefix.  Mklink can create several types of links, including the following:

  • /D – creates a soft symbolic link, which is similar to a standard folder or file shortcut in Windows.  This is the default option, and mklink will use it if you do not enter a prefix.
  • /H – creates a hard link to a file
  • /J – creates a hard link to a directory or folder

So, once you’ve chosen the correct prefix, you need to enter the path you want for the symbolic link, and the path to the original file or folder.  For example, if I wanted a folder in my Dropbox folder to appear like it was also stored in my desktop, I would enter the following:

mklink /J C:UsersMatthewDesktopDropbox C:UsersMatthewDocumentsDropbox

Note that the first path was to the symbolic folder I wanted to create, while the second path was to the real folder.

Here, in this command prompt screenshot, you can see that I created a symbolic link of my Music folder to my desktop.

And here’s how it looks in Explorer.  Note that all of my music is “really” stored in C:UsersMatthewMusic, but here it looks like it is stored in C:UsersMatthewDesktopMusic.

Thats it, ready to use as a linked folder.

contact us