In the context of NTFS:

MKLINK [[/D] | [/H] | [/J]] Link Target

/D Creates a directory symbolic link. Default is a file symbolic link.
/H Creates a hard link instead of a symbolic link.
/J Creates a Directory Junction.
Link specifies the new symbolic link name.
Target specifies the path (relative or absolute) that the new link refers to.

  1. Isn't a directory junction the exact same thing as a directory symbolic link?

    What's the difference between mklink /D f1 f2 and mklink /J f1 f2 ?

  2. Since a "directory" is actually just a file, what would be the difference between a directory symbolic link and a file symbolic link?

up vote 322 down vote accepted

A junction is definitely not the same thing as a directory symbolic link, although they behave similarly. The main difference is that, if you are looking at a remote server, junctions are processed at the server and directory symbolic links are processed at the client. Also see Matthew's comment on the fact that this means symbolic links on the local file system can point to remote file systems.

Suppose that on a machine named Alice you were to put a junction point c:\myjp and a directory symbolic link c:\mysymlink, both pointing to c:\targetfolder. While you're using Alice you won't notice much difference between them. But if you're using another machine named Bob, then the junction point

\\Alice\c$\myjp will point to \\Alice\c$\targetfolder

but the symbolic link

\\Alice\c$\mysymlink will point to \\Bob\c$\targetfolder

(Caveat: by default, the system doesn't follow symlinks on remote volumes, so in most cases the second example will actually result in either "File Not Found" or "The symbolic link cannot be followed because its type is disabled.")

The difference between a directory symbolic link and a file symbolic link is simply that one represents a directory and one represents a file. Since the target of the link doesn't need to exist when the link is created, the file system needs to know whether to tell applications that it is a directory or not.

It should also be noted that creating a symbolic link requires special privilege (by default, only available to elevated processes) whereas creating a junction only requires access to the file system.

  • 12
    Just to be clear: there may well be other subtler functional differences between directory junctions and directory symbolic links. The remote vs. local thing is just the most obvious from a user (as opposed to a developer) perspective. – Harry Johnston Oct 5 '11 at 4:02
  • 9
    @MatthewSteeples do you mean that if I create a symbolic link C:\testlink (which points to C:\test on my computer) and someone remote access my computer and clicks on C:\testlink, it would resolve to the C:\test on HIS computer, Whereas if I create a directory junction C:\testlink (which points to C:\test on my computer), and someone remote access my computer and clicks on C:\testlink) it would lead him to the C:\test on my computer? Or did I get it the wrong way round? – Pacerier Oct 5 '11 at 8:19
  • 7
    @Pacerier in this context yes, but symbolic links allow you to have a folder on your computer that points to a network share (because they're resolved client side). Eg C:\MyNetworkShare could actually point to \\Alice\Share – Matthew Steeples Oct 6 '11 at 14:57
  • 4
    @MatthewSteeples but couldn't we create a directory junction C:\MyNetworkShare which points to \\Alice\Share as well? – Pacerier Oct 7 '11 at 10:44
  • 6
    @Pacerier, no, junction points have to be local. – Harry Johnston Oct 8 '11 at 0:05

Complex talk hurts brain -- I like charts:

Assume any MyLink is a symbolic link and any MyJunc is a junction pointing at Target as created.

e.g.

mklink /D MyLink C:\T_Dir for creating a symbolic link to the target directory

mklink /J MyJunc C:\T_Dir for creating a directory junction to the target directory

Where syntax is mklink [/J,/D] [link path] [target path] as typed on local machine


 link path    |   target path   |         When accessed ..
              |                 |  (locally)    |    (remotely)
              |                 |               |
C:\MyLink     |   C:\T_Dir      |  C:\T_Dir     |  [leads back to local]
C:\MyJunc     |   C:\T_Dir      |  C:\T_Dir     |  [leads to remote]
              |                 |
\\Svr\MyLink  |   C:\T_Dir      |   C:\T_Dir    |  [leads back to local]
\\Svr\MyJunc  |   C:\T_Dir      |  *** Must create and point local ***
              |                 |
C:\MyLink     |  \\Sv2\T_Dir    |  \\Sv2\T_Dir  |   Error*1
C:\MyJunc     |  \\Sv2\T_Dir    |  *** Error - Must point local ***
              |                 |
\\Svr\MyLink  |  \\Sv2\T_Dir    |  Error*1
\\Svr\MyJunc  |  \\Sv2\T_Dir    |  *** Must create link using target device ***

Error*1 - If you unblocked access to remote symbolic links on your local machine, then this would work .. but only on the local machine where it's unblocked

  • 1
    That is so weird. Even relative symbolic links don't work remotely. E.g. I create a directory d:\_tmp\data. Create link like so: d:\_tmp>mklink /d data-link data. Remote user has full access to d:\_tmp and all its subfolders BUT he will still not be able to open d:\_tmp\data-link. – Nux Aug 19 '16 at 11:18
  • 2
    That is because when a symbolic link gets evaluated client-side it would be pointing to d:\_tmp\data on the client, not the server. – apraetor Sep 24 '16 at 12:13
  • I think the reason why it's weird is clear. But I agree with @Nux that it IS weird, at least in the case of relative symlinks. – Jon Coombs Mar 21 '17 at 22:36

I was under the impression that junctions were just around for legacy reasons and symbolic links were altogether better (things appear this way at face value). Turns out, that's not entirely true. There are some good reasons to use a junction instead of a symbolic link. The major difference comes down to security and remote vs. local paths. Yes, remote targeting makes symbolic links more functional, but also raises their security profile. So, if you want a local link and can live with an absolute path, you're probably better off with a junction; otherwise, consider a symbolic link for its added abilities.

enter image description here

**The statement of difference in speed/complexity comes from an unverified statement in the Wikipedia entry on NTFS reparse points (a good read).*


Other NTFS Link Comparisons

Here are some other comparisons on the topic, but these can be misleading when considering junctions because they don't list the benefits I list above.

Taken from here (a good introductory read)

enter image description here

From SS64 page on MKLink

enter image description here


Comments about Terminology

Junctions are Symbolic Links

Junctions and Symbolic links are really doing the same thing in the same way (reparse points), aside from the aforementioned differences in how they're processed. In fact, technically, a Junction is a symbolic link, and sometimes documentation might call a Junction a symbolic link, as is the case here. So, that's just something to be aware of regarding terminology.

NTFS

Even though the OP specifies this, it's worth pointing out that "symbolic link" is a very general term that is not specific to NTFS. So, to be specific, this comparison is about NTFS Junctions vs. NTFS Symbolic Links.

  • Anyone tested the processing speed of Junctions vs Symbolic Links? – 1000Gbps Sep 1 at 13:59
  • The pros/cons chart was extremely helpful, thank you! – GordonM Sep 20 at 15:52

protected by Community May 31 '16 at 3:50

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.