How to Create Symbolic Links on Windows Using mklink?
This post illustrates how to create symbolic links on Windows using mklink.
How to Use mklink on Windows?
Mklink command can be used to create shortcut links on Windows using Command Prompt. The following syntax is used to run the mklink command:
- /d, /h, and /j represent the mklink options. Only one option can be utilized at a time to create a link.
- Link Route indicates the shortcut soft, hard, or junction directory that will be created using this command.
- Target Route indicates the directory towards which the Link Route points.
Options of mklink
/d – This option creates a soft directory symbolic link.
/h – This option creates a hard file link.
/j – This option creates a junction directory link.
To see how the mklink command works on Windows, follow the steps exhibited below.
Step 1: Open Command Prompt
In the Start menu, type “cmd” and click on the “Run as Administrator” option:
Step 2: Execute the mklink Command
Type the below-given command in the cmd and hit the Enter button to create a mklink:
Here in this command:
- mklink is used with the “/d” option to create a soft link.
- “C:\Users\USER\Desktop\link-to-pictures” represents the Destination Route.
- “C:\Users\USER\Pictures” represents the Source Route.
The above result shows that the soft symbolic link has been successfully created.
Step 3: View the Result
Go to the route where you created the symbolic link. In this case, a link on Desktop was created:
The above screenshot shows a folder named “link-to-pictures” on the Desktop. The User can access the pictures folder from this soft directory symbolic link.
Conclusion
The mklink command is used to create shortcut symbolic links on Windows. The mklink command is followed by the option, link name, and the target route for the shortcut link. To use the mklink command, open the “Command Prompt” from the Start menu. Type in the “mklink” command with the link route and target route to create a soft symbolic link to a specific folder at a specific location. This write-up has presented a step-by-step procedure for creating symbolic links on Windows using mklink.
Source: linuxhint.com