| by Arround The Web | No comments

How to Create Symbolic Links on Windows Using mklink?

mklink is a keyword used to create a shortcut link for a directory at a desired location on the PC. It is used to make a directory easily accessible in case it is present somewhere deep in the system. By default, mklink creates a symbolic link. However, an option can be specified with this keyword to determine the nature of the link to be created, such as soft, or hard.

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:

mklink <[/d] or [/h] or [/j] > <Link Route> <Target Route>
  • /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:

mklink /d C:\Users\USER\Desktop\link-to-pictures C:\Users\USER\Pictures

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.

Share Button

Source: linuxhint.com

Leave a Reply