For a long time Linux and Unix have had the marvellous ability of allowing user created links on their file systems. These links are file and folder pointers that are sorted and registered by the operating system file partition. But unlike the more common Microsoft Windows short-cut, programs that encounter user created links will treat them as the source file or folder.
This is advantageous for a number of reasons especially if you use multiple partitions on your computer. I for example keep all my work related files on a separate partition labelled as the W: drive. This allows me to optimise searches and backups as well as keeping the partition more secure from potential problems.
Part of my work involves web development and for testing often the files I am working with need to be located within a web server’s root directory. But this can be problematic if the server application is installed on the C: drive. So a hard link is useful as I can create a pointer from the server root directory and target it to the folder containing the project files on the W: work drive. Once the project is completed the hard link can be removed which would sever the link to the testing web server without the need to move any files.
The Windows NTFS file system has supported some form of file and directory pointing since Windows 2000. Unfortunately each revision of Windows until Windows Vista has used a different method of implementing these pointers. So for this article I will just focus on Windows Vista and the identical Windows 7/8 implementations.
In Windows what is the difference between a short-cut, a symbolic link (sym-link) and a hard link?
A short cut is a file that points to another file. It is an antiquated pointing system from the Windows 95 era that many programs do not recognise. Short-cuts do not only use up space on the hard drive, they also break and linger behind after the target has been deleted, renamed or moved.
A symbolic link is like a short-cut but instead of being saved as a file it is registered to the hard drive partition. It does not use any disk space and all programs recognise both the link and the target. A symbolic link can point to any file or folder either locally on the computer or over a network using a SMB path.
A file hard link is a little different and can not be used over multiple partitions meaning you can not have a link on drive C: pointing to a file on drive D:. A file hard link points to and duplicates a target as a mirrored copy but the copy does not use any additional space on the hard drive partition. So 2 hard links that mirrored a 1 GB file would in total only use 1 GB on the partition rather than 3 GB. Importantly if either the hard links or the target are deleted the other links retain the data. Changes to the content of either the target or the links automatically propagate to all other items.
A junction is a hard link for directories but unlike file hard links you can create junctions that span multiple partitions. Again a directory junction and its content is stored on the hard drive partition but they do not use any additional space. Any changes to the content within either the target or the links will automatically propagate except where the target directory is deleted or renamed. In that case all hard links that point to the target will break and linger on the partition.
Microsoft Windows Vista, 7 and 8 use the command line program mklink to create symbolic and hard links. It has 3 arguments and requires both a link name and target.
mklink /D /H /J [LINK NAME] [TARGET]
There are 4 modes for mklink which counteract each other so you can only use at most a single argument.
Supplying no arguments creates file symbolic link which is a pointer to a file.
/D creates a directory symbolic link which is a pointer to a directory.
/H creates a file hard link and is best used in situations where you need multiple mirrors of a file.
/J creates a directory junction which is a directory hard link that mirrors a the target directory over the same or on a different hard drive partition.
The word mirrors in this context means the live duplication of the target and the links. Any changes to the structure or the content of any files or any directories will propagate instantly to all links and to the target.
mklink /J WindowsVista C:\Windows
This command would create a directory junction WinVista linking (pointing) to the directory C:\Windows
Below is a screen capture of the 4 different types of symbolic and hard links. The yellow is a hard file link that does not consume any additional hard drive space. The blue is a symbolic link to a file. The green is a symbolic link to a file directory. While the red is a hard link to a directory which is commonly known as a directory junction.

#1 by seedjay on October 25, 2009 - 8:27 am
See also the hardlink shell extension tool: http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
#2 by Venemo on November 1, 2009 - 1:05 am
Hi,
Your article has helped me clarify a lot of things.
There is one question that I don’t really know: What is the difference between a “directory symbolic link” and a “junction”?
Thanks in advance!
#3 by Ben on November 1, 2009 - 9:39 am
It is a little complicated but originally Windows 2000/XP only supported directory junctions, but these were not compatible with other file systems, files or network shares. So with Windows Vista Microsoft added file and directory symbolic links. This not only allowed connection with remote SMB network paths ( //SERVER/Directory/ ) but they were also more compatible with the POSIX operating-system standard, aka Linux/Unix links.
Microsoft had to keep their older Junction system within NTFS for backwards compatibility with Windows 2000/XP. But if you are not using these systems, then you are probably better off sticking with symbolic links.
#4 by Venemo on November 2, 2009 - 10:23 pm
Thank you very much
#5 by Robert on November 3, 2009 - 2:56 am
Ok… great your article has helped me out quite abit. but how do i get a report of all the existing junction links? Am i correct in assuming that the documents and settings folder is actually a directory junction hard link to the users folder?
Thanks…
#6 by Ben on November 3, 2009 - 8:23 am
I don’t think there is an easy way of listing all your symbolic links without using a third party program. I can’t vouch for this program but it seems to do what you are looking for Robert.
DiskJunction (http://www.pcmag.com/article2/0,2817,2347491,00.asp)
#7 by Robert on November 3, 2009 - 3:03 am
self correction…. it looks like vista ueses symbolic links and not hard links (otherwise it would say junction).
#8 by Henrik on December 14, 2009 - 5:46 pm
Really nice articel. But i think the green link is as symlink to a directory. “The green is a symbolic link to a file.”
#9 by Ben on March 6, 2010 - 8:23 am
fixed, thanks.
#10 by stone on February 27, 2010 - 11:37 am
one very important information is missing. directory junction links can be moved to another directory and they still point to the right destination. when you however move a symbolic link, it’s no more valid.
#11 by Ben on March 6, 2010 - 8:31 am
My reply comment is only referring to Windows 7, but I imagine it would be the same in Windows Vista. If you move a symbolic link or a directory junction into another folder, both links maintain the correct pointer. If you rename or move the pointer, both links do not update.
#12 by ElTorqiro on December 10, 2010 - 3:35 pm
Sorry to dredge up an old thread, but I found this very useful in understanding the difference between a Junction and a Symbolic Link. I was always curious as to what Symbol Links brought to the table that were new in any way, so thanks for the article.
I would like to clarify one point, specifically related to the point “stone” was making. There is a difference between how Junctions, Symbolic Links and Volume Mountpoints are treated when performing file system operations such as move/copy etc. If you create a Symbolic Link, and you then move that link it is much the same as a shortcut in that it just moves the link itself, no actual data is moved/copied.
However, if you move a Junction or Volume Mountpoint, a new folder is created at the move destination point and the contents of the original data folder is physically moved from its source location to the new move location. The Junction or Volume Mountpoint remains where it was, and the source folder remains intact (it just becomes empty).
So there are differences in the way Windows treats the types of links. Try it out and you will see what I mean.
I have tested this on Windows 7, I do not have Vista.
#13 by Rocky Madden on December 27, 2010 - 4:18 am
Wonderful write up, thank you.
#14 by katepermazone on July 1, 2011 - 3:32 pm
After a clean install of my Vista 32-bit OS, I am taking the opportunity to redirect my user folders away from the C: drive. It is a process fraught with frustration due to duplication of folders and inability to delete the empty original folders. Although there are plenty of helpful suggestions out there for complex registry edits, this seems a cumbersome and untidy – not to mention risky – approach. So a MKLINK /J redirection from source to my desired partition would be an elegant and convenient ‘solution’, if I can make it work.
But it’s not working at the moment! From the cmd prompt (regardless of which drive or directory I start from), when I enter I receive error message: ‘Cannot create a file when that file already exists.’
Could you please advise whether (a) it is possible to create a junction across partitions? And (b) if so, what is the correct syntax?
Many thanks in anticipation.
#15 by katepermazone on July 1, 2011 - 3:34 pm
Sorry – that should read:
From the cmd prompt (regardless of which drive or directory I start from), when I enter
“mklink /j c:\users e:\users”
I receive error message: ‘Cannot create a file when that file already exists.’
Could you please advise whether (a) it is possible to create a junction across partitions? And (b) if so, what is the correct syntax?
Many thanks in anticipation.
#16 by Ben on July 1, 2011 - 3:44 pm
You syntax directory / target syntax looks to be wrong way around, you need do LINK NAME then TARGET. Your example is trying to join E:\users and create the junction at c:\users. But that will not work because you have an existing directory already there.
Try “mklink /j e:\users c:\users”
#17 by GOSteen on August 4, 2011 - 9:25 pm
Okay, everyone seems to have skipped over this so I’m wondering if I’m just not familiar with it because I’m not as used to Windows as I am Linux…
How did you get the color support in your terminal? Is it a terminal replacement of some sort or some special hack or just some image editing trick?
Other than that; very decent article. You may wish to know, however, that on most UNIX/Linux systems a symbolic link does, in fact, take up space though it is not much. It is created as a special independent file which takes up a minimal amount of space and acts as a pointer to a different location where the target file may be found. Hard links share the target file’s inode and, as such, don’t take extra space in the filesystem itself. As well, because POSIX-compliant systems follow the ‘everything is a file’ philosophy, there is no distinction between a ‘file’ link and a ‘directory’ link. So one needn’t worry about figuring out how to create a ‘directory junction’ in *nix.
#18 by Ben on August 5, 2011 - 7:36 am
Hi GoSteen unfortunately that screenshot is not a colour terminal rather it involved some post image editing to simply highlight the different types of links. As a Linux user yourself I would highly recommend using Cygwin and combine it with Mintty for a decent terminal for Windows. It also gives you a slew of ported Linux shell apps, full access to your ntfs partitions and most importantly colour.
http://code.google.com/p/mintty/
#19 by Srivathsan Ashokkumar on August 5, 2011 - 3:16 pm
Is it possible to make remote system files softlink? iF possible let me know the procedure.
#20 by Ben on August 5, 2011 - 5:36 pm
I did a quick test on Windows 7 and managed to create a symbolic directory link to a shared directory on my local network.
I ran command prompt as an Administrator and then ran the following
mklink /d testlink \\NAS\my_shared_folder_name
I could then cd \testlink and that would take me to the folder stored on the NAS. I hope that helps.
#21 by Luke on August 25, 2011 - 3:18 pm
My computer has an SSD (boot drive) and an HDD (data drive). I have relocated the Documents folder to the HDD, but would like for one small folder (which needs to be be in the Documents folder for some program to work) to be stored on the SSD for decreased latency. If I use a directory junction, will the HDD need to be read to reach the link in the file system? Is there an interim case where the file system is in some chip in the HDD assembly at the end of the SATA cable, but not on the disk that has to spin up?
#22 by Ben on September 19, 2011 - 3:27 pm
Sorry for the slow reply Luke I must have mistakenly missed your question.
I am pretty sure that the junction data will be contained within the NTFS file system on the HDD rather than your target SSD drive. So the HDD containing this junction the target details will probably need to be read at least once. I don’t know if after it has been read for the first time if Windows remembers the target and keeps the information in the system memory.
#23 by Julius Gabriel Perkins IV on September 18, 2011 - 4:21 am
Any thoughts on creating a directory symlink or junction for the “System Volume Information” directory on C? More information here http://social.technet.microsoft.com/Forums/en-US/w7itproinstall/thread/c376d8b4-0ae9-4bcf-bfbe-434976c6a31f
#24 by Ben on September 19, 2011 - 3:03 pm
I have never done it myself nor seen it written about. The System Volume Information directory is specifically used to house Windows System Restore files and databases. Considering the purpose of System Restore is to have a ready fail-safe recovery point in case your operating system, software or some drivers go haywire to be on the cautious side it is probably best not to play around with this. If you don’t need this extra protection and wish to save some disk space you could simply turn System Restore off.
#25 by Christopher L Banacka on January 29, 2012 - 9:20 pm
Hello, I have done this a few months ago in windows 7 without issues.
But currently I am getting an error in windows, as if the junction link is not working.
When trying to login i get “The user profile service service failed the logon. User profile can not be loaded.”
E = SSD
D = HHD
(as shown from disk part)
robocopy /copyall /mir /xj E:\Users D:\User
(no errors, takes about 15secs)
rename e:\users e:\users.bak (also note i have renamed the folder to something like TESTING) just in case the .bak was confuisng it)
mklink /J E:\Users D:\Users
Do a few tests, If i go to E:\users and create a folder, then go to D:\users i see it; all looks good. And still same issue.
I have done this about 10times to make sure im not being retarded.
One fishy thing that i have seen, is if i use rmdir e:\users (deleting the junction), then the d:\users should be deleted, but its NOT! It is staying there…
Anything that i am doing wrong? I swear this is what i did like 6months ago with two normal HHDs…
#26 by Ben on January 30, 2012 - 9:13 am
Well I don’t know if this is a typo in the comment … but you are missing the trailing S on D:\User
robocopy /copyall /mir /xj E:\Users D:\User
But your symlink is pointing to D:\Users
mklink /J E:\Users D:\Users
#27 by AJ Luna on March 3, 2012 - 11:49 pm
Thank you. I have been searching for 4 hours now just so I could fully understand the difference between SymLinks and hard links. You gave the simplest explanation but gave it enough clarity. Now I can sleep.
Oh, but wait. I do have a question. Is there any way to customize SymLinks so they’ll look distinguishable from the normal shortcut?
#28 by Ben on March 6, 2012 - 9:00 am
In the command prompt there is a visual difference between a shortcut and a symbolic link. The shortcut will always have an file name extension “.lnk” and take up 1+kB while the symlink will not show any file size and instead list “SYMLINK”.
On the Explorer/Desktop side of things I haven’t found away to visually distinguish symlink icons from those of shortcuts. I don’t think you can as when you open the properties of either a shortcut or a symlink icon they both have a “shortcut” tab. So I think for Windows Explorer and the Desktop it treats them as the same.
In Windows Explorer if you switch into “list” view, a symlink will always be 0 bytes yet its “Item type” will always share the same as its target. So a symlink pointing to a PDF file will display “Adobe Acrobat Document” as the Item type. While a shortcut will be 2 kB and have an “Item type” of “shortcut”.
#29 by Steven Hovey on March 6, 2012 - 1:39 am
Great write up. I am about to buy an SSD drive just for windows and make that my new C drive, then I want to make my new 1 TB HD (e: drive) for the Users, windows\temp, temp, program files, and program files x86 directories. Can you give me the run down of commands to type to use those directories on the hd? I want the SSD drive to basically be read only unless a windows update has to be performed. I want all the usual directories that change alot to be on the HD to limit the reads/writes on the SSD. Thanks in advance!
#30 by Ben on March 6, 2012 - 9:18 am
That is a little out of the scope of this article. Basically you need to manually move all the directories over to your HD E: drive and then presumably create a directory symbolic link or a directory junction at their expected locations on the SSD C: drive. It is not something I have done as theses directories are critical Windows items. So I don’t know how the attempt would succeed as Windows has some inbuilt automatic restoration protections to stop users accidentally messing up their installations.
It would probably be easiest and safer if you did the change on a fresh, clean install of Windows. If you are trying to do this on an existing install make sure you backup everything before attempting to move those directories!
This semi-convoluted Life Hacker article might be of help.
http://lifehacker.com/5467758/move-the-users-directory-in-windows-7