Open In App

Creating Junction Points

Improve
Improve
Like Article
Like
Save
Share
Report

Junction Points (also commonly referred to as NTFS Junction or Directory Junction) is a type of reparse point which contains a link to a directory that acts as an alias of that directory. Junction points are a Windows exclusive feature, absent in other operating systems. Compatibility with Legacy Windows OS and less privilege requirement makes Junction Points a good alternative for symlinks. In this article, we will take a look at methods used for the creation of junction points on Windows OS.

Description of the command :

Mklink /J Link Target

Description of command as follows.

/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.

Note –
The above text is a stripped-out section out of mklink help page.

Creating a Junction Point :
Junction points can be created both relatively or absolutely, but they would always refer to the Target path in an absolute manner. Therefore, regardless of whether the link was created using relative paths or using absolute paths, the final target path would be absolute.

In the following example we would be creating an Junction Point to the Directory having C:\suga path in our Operating System.

To create a junction point at a different path (C:\Users\Public\), the command would look as follows.

mklink /J "C:\Users\Public\Junction_PT" "C:\suga"

Note –
We have provided both source and Target paths as absolute, for the sake of simplicity.

Where C:\Users\Public\Junction_PT is the full path to our newly created junction. After the execution of the above command, a Directory Junction would be created at the Link path, which could be confirmed by its entry of type <JUNCTION> in the output of dir command on the newly created junction’s parent directory.

Volume in drive C has no label.
Volume Serial Number is 2C7D-7820

Directory of C:\Users\Public

09/18/2020  06:22 PM    <DIR>          .
09/18/2020  06:22 PM    <DIR>          ..
09/18/2020  09:28 AM    <DIR>          Documents
06/22/2020  11:25 PM    <DIR>          Downloads
09/18/2020  06:22 PM    <JUNCTION>     Junction_PT [C:\suga]
06/22/2020  11:25 PM    <DIR>          Music
06/22/2020  11:37 PM    <DIR>          Pictures
06/22/2020  11:25 PM    <DIR>          Videos
              0 File(s)              0 bytes
              8 Dir(s)  36, 849, 307, 648 bytes free

Note –
Bolded the field we are interested in.
The junction point (Junction_PT) would have a similar appearance to this.


Last Updated : 05 Oct, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads