1. Home
  2. Windows Tips
  3. Create delete a junction link on windows 10

How to create and delete a junction link on Windows 10

You’ve probably heard of symbolic links, and how useful they are. You can create a symbolic link on Windows, Mac, and Linux. Symbolic links are more capable and as such, you need to be more careful when you deal with them. Another sort of link you can create between folders/locations is a junction link. A junction link is a sort of subset or a variation of a symbolic link. Here’s how you can create and delete a junction link on Windows 10.

Rules

A junction link is;

  • Created between folders. It cannot be created between files.
  • Can only be created between local drives i.e., not between network drives and local drives

Create junction link

In order to create a junction you need to first decide where you want to create the junction link, and which folder you want it to link to. The target folder should already exist i.e., the junction command will not create the folder for you.

For the sake of this post, we’re going to create a junction link to a folder in the D drive. This folder is called ‘Target folder’. We’re going to link to it from a sub-folder on the C drive.

The junction link will be created at;

C:\Users\fatiw\OneDrive\Pictures

Open Command Prompt with admin rights and run the following command.

Syntax

mklink /J "path to junction link" "path to target folder"

Example

mklink /J "C:\Users\fatiw\OneDrive\Pictures\target" "D:\target"

Take note that you must not create the ‘Target’ folder in the ‘Path to junction link’. Instead, you must only specify it in the command. Also, the name of the link does not have to be the same as the target folder. You can name the link anything you want and link it to your desired folder. Tap enter to create the junction link.

Delete junction link

There are two ways to delete a junction link. You can select it and tap the delete key on your keyboard, or you can delete it from the Command Prompt.

Open Command Prompt with admin rights and execute the following command.

Syntax

rmdir path to junction link

Example

rmdir "C:\Users\fatiw\OneDrive\Pictures\target"

Deleting a junction link will not delete the folder that it links to, and it will not delete any of the files in the target folder. Out of the box, there’s no way to create a junction link like there is to delete one via the GUI however, if you’re apprehensive about creating junction links you can find apps that give you a simple GUI for creating them.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.