Mklink command: Create symbolic links in Windows 7
I frequently use symbolic links on Linux, but I rarely use them on Windows 7. However, creating symlinks in Windows 7 is really easy via mklink. Here’s the syntax and a simple example.
Tip: When using the mklink command, never forget the quotes. Also, deleting the symlinks via the Windows Explorer works, you’re not deleting the actual folder
Mklink Command Syntax
MKLINK has 3 options /D, /H and /J. You also need to specify the path to the new symbolic link and the path to the original file or directory.
/D – used to create symbolic links for directories (d for directory)
/H – used to create hard links (h for hard link)
/J – used to create directory junction (j for junction
What Are Hard Links
Hard links can be defined as “real” links to a file. Windows will treat that link as if it was the original file or directory
Soft links are only shortcuts to a directory, they will not be treated as the real file
What Are Directory Junctions?
A directory junction is basically a hard link (see above) to a directory. We will use this in our example.
mklink /J "C:\Program Files (x86)\Steam\steamapps\common\audiosurf" "D:\audiosurf"
In this example I create a directory junction in C:\Program Files (x86)\Steam\audiosurf that points to the actual game folder D:\audiosurf
Mklink: Syntax Incorrect
A common mistake of people who are new to creating symlinks is that they forget to add the quotation marks. If you enter a long path and you don’t add the quotation marks to the paths it will output a syntax error, because of the many spaces.
You can either cd to a directory and use relative paths or you can simply add the quotation marks like
mklink /J "path" "path"
If you have any questions how to use mklink or if you need further examples to fully understand it, you may post your request below.
Change Steam Download Directory via MKLINK
Read our tutorial: How to change Steam download directory via symlinks