Share via


'mklink / j' or 'mlink / d'?

Question

Wednesday, September 5, 2018 5:09 PM

Is there someone who can briefly explain to me the difference between the use of 'junctions' and 'symbolic links'.

After all, I 'diverted' various directories to others and I used 'mklink / j' for that while often 'mlink / d' is advised.

Have read somewhere that the 'junctions' are faster than the 'symbolic links'.

I have a Windows 10 computer (1803).

regards,

All replies (4)

Wednesday, September 5, 2018 6:41 PM ✅Answered

mklink /J must be local yeah, mklink /D can be both (requires an admin to create though).

I found this document to be quite good on explaining:

https://www.2brightsparks.com/resources/articles/NTFS-Hard-Links-Junctions-and-Symbolic-Links.pdf

Blog: https://thesystemcenterblog.com LinkedIn:


Wednesday, September 5, 2018 5:37 PM

Hello!

In the link below there's an earlier post which describes the differences between a Junction and a Symbolic Link.

https://social.technet.microsoft.com/Forums/en-US/1c7fc896-9ce2-4dd1-aed6-e50c22e6a03a/junction-link-vs-symbolic-link?forum=w7itproinstall

Example:

Let's assume that MyLink is a symbolic link and any MyJunc is a junction pointing at Target as created.

You would use mklink /D MyLink C:\Temp for creating a symbolic link to the target directory.

You would use mklink /J MyJunc C:\Temp for creating a directory junction to the target directory.

Link Path     |   Target Path    |         When Accessed...
              |                  |  (Locally)   |    (Remotely)
              |                  |              |
C:\MyLink     |   C:\Temp        |  C:\Temp     |  [leads back to local]
C:\MyJunc     |   C:\Temp        |  C:\Temp     |  [leads to remote]
              |                  |              |
\\Srv1\MyLink |   C:\Temp        |   C:\Temp    |  [leads back to local]
\\Srv1\MyJunc |   C:\Temp        |  *** Must create and point local ***
              |                  |              |
C:\MyLink     |  \\Srv2\Temp     |  \\Srv2\Temp |   Error*1
C:\MyJunc     |  \\Srv2\Temp     |  *** Error - Must point local ***
              |                  |              |
\\Srv1\MyLink |  \\Srv2\Temp     |  Error*1     |
\\Srv1\MyJunc |  \\Srv2\Temp     |  *** 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

Best regards,
Leon

Blog: https://thesystemcenterblog.com LinkedIn:


Wednesday, September 5, 2018 6:34 PM

Thank you Leon for your extended response, but honestly, it makes me feel a bit dizzy ...

Can i say that as long as I use "mklink J" only on a local PC, it will not cause any problems,
"Mklink / D" to be preferred to use on a server and/or a lokal PC?

Or is that said too simply?


Wednesday, September 5, 2018 7:02 PM

mklink /J must be local yeah, mklink /D can be both (requires an admin to create though).

I found this document to be quite good on explaining:

https://www.2brightsparks.com/resources/articles/NTFS-Hard-Links-Junctions-and-Symbolic-Links.pdf

Thank you very much for your response!!!
I will study the document ..

Regards,