An NTFS junction point
(JP) is a feature of the NTFS file system
version 3.0 or later. It is a type of NTFS reparse point
. Junction Points can be used in a similar way to symbolic links
— allowing the creation of a link to a folder that is, for most intents and purposes, the same as the folder itself. This has many benefits over a Windows shell shortcut
(.lnk) file, such as allowing access to files within the folder via Windows Explorer
, the Command Prompt
Junction points can only link to directories, and moreover, local directories only; junction points to remote shares are unsupported. For linking to files, possible alternatives to junction points (aside from shortcuts) include hard links (which have the restriction that the file must belong to the same logical volume), and symbolic links (which are only included in Windows Vista and newer, but do work over network shares).
The Windows 2000 and XP Resource Kits include a program called linkd to create junction points; a more powerful one named Junction was distributed by Sysinternals' Mark Russinovich.. FAR Manager can create junction points by the pressing of Alt+F6.
- Microsoft strongly recommends:
- Use NTFS ACLs to protect junction points from inadvertent deletion.
- Use NTFS ACLs to protect files and directories targeted by junction points from inadvertent deletion or other file system operations.
- Never delete a junction point using Explorer, a del /s command, or other file system utilities that walk recursively into directory trees. These utilities will affect the target directory and all subdirectories. Instead, use the utilities described below to delete junction points.
- Use caution when applying ACLs or changing file compression in a directory tree that includes NTFS Junction Points.
- Do not create namespace cycles with NTFS or DFS junction points.
- Place all junction points at a secure location in a namespace where they can be tested safely, and other users will not mistakenly delete them or walk through them.
- Obscure: There are issues relating to junction points on MS Windows 2000 domain controllers & certain Active Directory files.
Examples of use
By setting a JP that points to a directory containing a particular version of a piece of software, it may be possible to add another version of the software and redirect the JP to point to the version desired.
Windows XP Professional
- Deleting a JP using explorer is not safe — it will delete the targeted files immediately as if using shift-delete.
- Beware: if the JP is sent to the recycle bin, the targeted files will look safe, but will be deleted when the recycle bin is emptied.
- Moving the JP to a different location on the same drive only moves the JP, however moving to another drive turns the JP into a normal folder and moves all files there (leaving the targeted directory empty).
- While walking through the directory with explorer, use shift-delete to delete folders, however files can be deleted normally.
- A solution for these issues (except that shift-delete is still needed to delete folders) is installing NTFS Link, which makes Windows Explorer handle junctions correctly. One can also use the fsutil application to delete and query reparse points (administrative privileges are required).
Command Prompt (cmd.exe)
- The dir command in Windows 2000 or later recognizes junction points, displaying
in directory listings (use dir with the
/AL command-line switch).
- Any commands that would normally affect files inside a normal directory will act the same here. Thus the command
del myjunction should not be used — this will just delete all the files in the targeted folder.
- The commands rmdir and move work fine with junctions, with the caveat that
move won't let the junction move to another volume (as opposed to Windows Explorer, as mentioned above.)
- The rmdir command is safe in that it only deletes the JP, not the targeted files.
- Whilst walking through the directory with the command line interface, files can be deleted, but unlike explorer, directories can also be deleted (using
rmdir /s dirname for example.)
- Using the
linkd command with the
/d switch is a safe way to delete junction points.
- An infinite loop in the file structure can be created by placing a JP in the folder it targets. (Creating this is not recommended.)
- ACL inheritance is by design based on volumes and not working across junctions.
- Disk free space might not show up correctly. This depends on the API call the application is using. The old style
GetDiskFreeSpace() function the Windows Explorer is using does only accept the root directory of a device and will therefore only show the amount of free space of the root volume. Reparse point-aware applications use
GetDiskFreeSpaceEx() to determine the free disk space of the device of a specific directory.
- JP are indicated with an arrow icon overlay.
- Deleting a JP using explorer is now safe.
- A JP can be restored from the recycle bin.
Windows Vista supports a new symbolic link capability that replaces junction points in Windows 2000 and Windows XP. They are designed to aid in migration and application compatibility with UNIX operating systems.
Unlike a junction point, a symbolic link can also point to a file or remote SMB network path. Additionally, the NTFS symbolic link implementation provides full support for cross-filesystem links. However, the functionality enabling cross-host symbolic links requires that the remote system also support them, which effectively limits their support to Windows Vista and later Windows operating systems.
- Junction Link Magic – Windows graphical interface for creating, updating and deleting junction points
- Winbolic Link – Windows graphical interface for creating, updating and deleting junction points and shortcuts
- NTFS-Link – Windows shell extension that allows creating junction points and hard links. Existing junction points and hardlinks get marked by a small additional icon in the explorer.
- Junction – command line utility
- Hardlink Shell Extension – adds new entries for managing hardlinks and junctions into the Windows Explorer context menus
- Link Creation Shell Extension – another windows shell extension that allows creating junction points and hard links.
- Alax.Info NTFS Links – One more shell extension with an icon overlay indication for junction points, confirmation/choices dialogs for safe deletion of junction points, support for hard links.