5

Symbolic links were introduced an incredibly long time ago in Windows, yet I still encounter a large number of systems that use junction points. I know that symbolic links afford functionality not in junction points (e.g., they work on external drives); my question is whether there is functionality specific to junction points that make them more appropriate than symbolic links in some circumstances.

Benjamin Pollack
  • 235
  • 1
  • 2
  • 6

2 Answers2

3

There's at least one circumstance where you can't replace a junction point with a symlink: if the content might need to be accessed remotely. If you access a file share on a Windows machine, junction points are interpreted by the server and work as expected. Symbolic links are interpreted by the client (i.e., a symlink to c:\foo\bar would be interpreted as pointing to the client's C drive) and are disabled by default anyway.

Incidentally, junction points do work on external drives.

Harry Johnston
  • 5,875
  • 4
  • 35
  • 52
  • 3
    +1 We use junctions over symlinks for this exact reason. Makes it quite simple to create a `latest` or `testing` branch on a deployment server. – jscott Jun 06 '12 at 03:11
1

I've never created a junction. I've created plenty of links.

Junctions are very old technology. They were introduced in Windows 2000, so they are compatible with every version of Windows. They are typically used only for directories on the same local volume. The classic example is for the C:\Windows\sysvol\sysvol\[your ad domain name] directory, that is actually a junction point to C:\Windows\sysvol\domain\.

Another piece of Windows trivia: In Windows 7, Microsoft created an infinite loop on the C:\ volume. The "C:\Users\%USERNAME%\AppData\Local\Application Data". "Application Data" is a junction that points to "C:\Users\%USERNAME%\AppData\Local\" for compatibility with legacy applications.

A Windows 7 system has thousands of links. Many exe and dll files located in the C:\Windows\system32 directory are actually links to files located in the C:\Windows\winsxs directory. That is one reason that the winsxs directory should not be "cleaned up". You can view the links by running the following command from the C:\Windows\system32 directory.

for %i in (*.exe,*.dll) do fsutil.exe hardlink list %i  

(If you run that in a cmd file, you may need two percent signs for the list %%i)

https://en.wikipedia.org/wiki/NTFS_junction_point

Greg Askew
  • 34,339
  • 3
  • 52
  • 81