How to create junction links on Windows Server 2022

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:

C:\NewJunction

and

C:\Users\Administrator\Download\Junction

To create the link, search for the Command Prompt, right-click on it, and select “Run as administrator.”

Graphical user interface, application

Description automatically generated

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.

Text

Description automatically generated

Verify the link by running the below command:

dir /al /b

Graphical user interface, text

Description automatically generated with medium confidence

Alternatively, running the below command will list all directories and junctions

dir

Graphical user interface, text, website

Description automatically generated

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 “…”

Text

Description automatically generated

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.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *