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.
Mklink Example
Enter 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 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.
When To Use Junction Points vs. Symlinks
Most hard links on Windows will be junction points, but certain programs may only support Symlinks. According to TechNet, symlinks were first introduced for better Linux compatibility (although I fail to see how it is compatible at all). In any case, it is a good idea to first create a junction point and then if that does not work out, create a symlink. Symlinks are also great for relative file links e.g. ..\..\..\..\my-nested-folder
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
Does not work.
adam, I can’t help you if you don’t post an error message. Mklink is very easy to use and I suppose your forgot the quotations or you simply copy and pasted, which will not work, because you need to manually type the quotation marks.
i create symbolic link with mklink on desktop, when i try to doubleclick it to open a file the link was created for, i receive an error.
Do both drive need the same file system in order to use this?
Hi,
I am trying junction link. But I am getting error-
Cannot create a file when that file aready exists.
What could be the possible cause of this error. Both my source and destination are folders.
This worked like a CHARM! Thanks SO much for posting it! Saved me at least 4GB on my SSD…
Just to clarify to those who might not realize:
The file you wish to point to on your other drive (D:, E:, F:, etc.) MUST NOT EXIST yet on the C: drive before you create it through mklink.
For example, if you wish to point from
“C:\Program Files (x86)\Adobe\Adobe Premiere Elements 9\Movie Themes”
to
“D:\Adobe\Adobe Premiere Elements 9\Movie Themes”
then you need to DELETE the “Movie Themes” folder on the C: drive first before mklink can create a Junction there for it.
A simple concept, I know, but if one doesn’t completely grasp what mklink is actually doing, then it’s an easy concept to miss…
Cheers!
I’m trying to make a link to my linux webhosting server: I used a webdisk program to assign a drive letter on my local PC that points to the Server Folder and that works fine but my backup program won’t recognize that drive letter as “local” So i thought mklink /D would allow the backup program to see this folder as “local” and allow me to backup from my home pc to the server. My command is not working though:
Web Drive is much like a mapped network drive and the location i want to link is Z:\Art1 and i want to link to C:\Art
mklink /D “Z:\Art1” “C:\Art” and i keep getting “cannot find the path specified”.
Please help
Wes
Hi
I am getting the following error message:
“The syntax of the command is incorrect.”
for the following command.
mklink /d “C:\Program Files (x86)\Origin Games” “P:\Origin Games”
P: is a partition on the second physical drive.
Please help.
Mike
Hi, i try to link FileZilla to my Dropbox directory like this:
mklink “C:\Users\Alexander Herbert\AppData\Roaming\FileZilla\sitemanager.xml” “C:\Users\Alexander Herbert\Dropbox\Firma\Einstellungen\sitemanager.xml”
and get the syntax error, no number or more information. Could you help to figure this out?
Thanks
thank you, very clear and helpful
Hi,
I am trying to link my iTunes backup folder on my 60Gb “C” drive partition to my much large “D” drive partition.
My iTunes “C” drive location is:
C:\Users\webster\AppData\Roaming\Apple Computer
My target location is:
D:\Users\webster\AppData\Roaming\Apple Computer\MobileSync
I have deleted the MobileSync folder from the “C” drive as mentioned above (i.e delete source folder)
From the CMD prompt I changed loaction to Apple Computer source location by:
cd C:\Users\webster\AppData\Roaming\Apple Computer
When trying to create the symbolic directory link using:
MKlink /D “MobileSync” “D:\Users\webster\AppData\Roaming\Apple Computer\MobileSync”
I get an error:
“The syntax of the command is incorrect”
Would you please be kind enough to guide me on where I am going wrong, I am sure it will be something simple. I have tried with / without quotation marks, used the full source location, but still no luck.
The reason for doing this is to redirect my iTunes backups to my “D” drive as my “C” drive is short on space.
Many thanks for all help given.
Martin
qSays I dont have proper permissions. Is there anything like the sudo command in linux for windows?
AMgold, no there is no sudo per se, you need to open an elevated command prompt to run admin functions
http://windows7themes.net/how-to-open-elevated-command-prompt-in-windows-7.html
great thing, helped me a lot to play music that was not in the target folder but referred to on an old playlist. Other articles misled. Thanks
Hello, I’m trying to use the mklink command to transfer from the default location for backup of Apple mobile devices to another drive. I believe I understand the directions for doing this, but when I open the command prompt it already starts with the “C:\Users\(username. (Which I’m unable to delete) So, I’m unable to enter the start of the command: \mklink /J “.
This is an excellent tutorial. Thanks for sharing. I’ve just moved my ‘outlook files’ from my C drive on a small SSD to my 1TB data drive.
This saved me 4GB of space. Awesome.
Just change USERNAME and destination link and you are good to go
I made a link that I want to delete and several have said to delete the file made my that mklink /J but don’t say where that file is or what it might be named. Any ideas about this? Do I have to rmdir the directory it is linked to? I am on Win 7 Pro, very new to it so I am having trouble moving my Public folders to a larger second internal drive. I got Pics, Music and Video to work on the PC, haven’t tried the network users, but didn’t get to Public\Documents. I screwed up somewhere…
Will not Work. Not only does it give me an error when I try to Open the Junction, but the game where I had saves in can’t find ’em!
Jeffrey, does it say “Junction created”? Also, instead of using junctions try mklink /d to create a symlink instead, maybe your game does not recognize junction points
Not all games may support them.
There is a difference between symbolic links /D and junction points /J – when in doubt, try both. NTFS junction points is what you would want to try first, only if that not works try a symlink. Most of the default links on Windows 7 are junction points
Symlinks are better used for absolute and relative file links (relative from a certain directy e.g. ..\..\I-a-m-here\; absolute: C:\Windows)
I;m trying to move my Creative Cloud Files off my SSD drive
here is the command and response
C:\Windows\system32>mklink /J “C:\Users\W520aldjfo\Creative Cloud Files” target
“D:\Administrator\Creative Cloud Files”
The syntax of the command is incorrect.
C:\Windows\system32>
Tom, might have to do with the fact that you have spaces in the filepath. Make sure to avoid curly quotes and use real quotes. also remove the word “target”
Would it be possible to symlink a windows 7 system folder like “fonts” using this method by deleting the fonts directory form the pc your creating the symlink from prior to mklink/J or mklink/H
???
In general you can symlink most folders, but in any case you should never simply delete a system folder. Move it fonts.bak and if it doesn’t work out, make sure you know to rename the folder via command prompt.
Messing with system files and folders is always tricky and you should know how to handle it (restoration using sfc.exe and opening a command prompt without explorer.exe etc)
I used mlink on my C:drive –> c:\mounts\spring which points to a network folder structure.
I want to move this link to my D: drive –> D:\mounts\spring instead.
All I really want to accomplish is to have this mapping on my D: drive instead of my C: drive but everything I find for cleaning up the mapping on my C: drive refers to deleting the destination folder structure — but I want to keep that intact.
How do I accomplish this without adversely affecting the files and folder structure I am referencing with this link?