Windows contains three types of file links.
Hard links: Creates a second directory entry to a file such that it can reference a file using more than one reference path.
Symbolic links: Creates a new file altogether that references an already existing file
Junction links: Creates a link between directories on different volumes or drives, but not between network drives. This link is only possible between folders.
Create a junction link on Windows Server 2022
Creating a junction link will link two folders together.
In our tutorial, we will create a junction link between the below two locations:
To create the link, search for the Command Prompt, right-click on it, and select “Run as administrator.”
Next, use the mklink command in the below syntax:
mklink /J “junction path link” “target folder path”
In our example, that would be as follows:
Note: The target folder must be created prior to running this command.
mklink /J “C:\Junction” “C:\Users\Administrator\Downloads\TestSetup”
The junction link is now created.
Verify the link by running the below command:
dir /al /b
Alternatively, running the below command will list all directories and junctions
Hide Windows Server 2022 junction links
To create a junction link with the target folder hidden, the below command can be used:
mklink /J …::$INDEX_ALLOCATION target folder
To confirm that the link is created as hidden, run either of the below commands:
dir dir /al /b
The destination will be listed as “…”
Delete Windows Server 2022 junction links
To delete an unused junction link, use the below command:
rmdir path to junction link
Note: Deleting a link will not delete the target folder or the files in the target location.