Windows 10, 8, 7, and Vista all support symbolic links—also known as symlinks—that point to a file or folder on your system. You can create them using the Command Prompt or a third-party tool called Link Shell Extension.
What Are Symbolic Links?
Symbolic links are basically advanced shortcuts. Create a symbolic link to an individual file or folder, and that link will appear to be the same as the file or folder to Windows—even though it’s just a link pointing at the file or folder.
For example, let’s say you have a program that needs its files at C:\Program. You’d really like to store this directory at D:\Stuff, but the program requires that its files be at C:\Program. You could move the original directory from C:\Program to D:\Stuff, and then create a symbolic link at C:\Program pointing to D:\Stuff. When you relaunch the program, it will try to access its directory at C:\Program. Windows will automatically redirect it to D:\Stuff, and everything will just work as if it were in C:\Program.
This trick can be used for all sorts of things, including syncing any folder with programs like Dropbox, Google Drive, and OneDrive.
There are two type of symbolic links: Hard and soft. Soft symbolic links work similarly to a standard shortcut. When you open a soft link to a folder, you will be redirected to the folder where the files are stored. However, a hard link makes it appear as though the file or folder actually exists at the location of the symbolic link, and your applications won’t know any better. That makes hard symbolic links more useful in most situations.
Note that Windows doesn’t actually use the terms “hard link” and “soft link”. Instead, it uses the terms “hard link” and “symbolic link”. In the Windows documentation, a “symbolic link” is the same thing as a “soft link”. However, the
mklink command can create both hard links (known as “hard links” in Windows) and soft links (known as “symbolic links” in Windows).
How to Create Symbolic Links with mklink
You can create symbolic links using the mklink command in a Command Prompt window as Administrator. To open one, locate the “Command Prompt” shortcut in your Start menu, right-click it, and select “Run as Administrator”.
On Windows 10’s Creators Update, you can use a normal Command Prompt window, without running it as an Administrator. However, to do this without an Administrator Command Prompt window, you must first enable Developer Mode from Settings > Update & Security > For Developers.
Without any extra options,
mklink creates a symbolic link to a file. The below command creates a symbolic, or “soft”, link at
Link pointing to the file
mklink Link Target
Use /D when you want to create a soft link pointing to a directory. like so:
mklink /D Link Target
Use /H when you want to create a hard link pointing to a file:
mklink /H Link Target
Use /J to create a hard link pointing to a directory, also known as a directory junction:
mklink /J Link Target
So, for example, if you wanted to create a hard link at C:\LinkToFolder that pointed to C:\Users\Name\OriginalFolder, you’d run the following command:
mklink /J C:\LinkToFolder C:\Users\Name\OriginalFolder
You’ll need to put quotation marks around paths with spaces. For example, if the folders are instead named C:\Link To Folder and C:\Users\Name\Original Folder, you’d use the following command instead:
mklink /J "C:\Link To Folder" "C:\Users\Name\Original Folder"
If you see the message “You do not have sufficient privilege to perform this operation.”, you need to launch the Command Prompt as Administrator before running the command.
How to Create Symbolic Links with a Graphical Tool
If you’re like to do this with a graphical tool, download Link Shell Extension. Be sure to download the appropriate prerequisite package before the tool itself—both are linked to on the tool’s download page.
Once it’s installed, locate the file or folder you want to create a link to, right-click it, and select “Pick Link Source” in the menu.
You can then right-click inside a different folder, point to the “Drop As” menu and select “Hardlink” to create a hard link to a file, “Junction” to create a hard link to a directory, or “Symbolic Link” to create a soft link to a file or directory.
How to Delete Symbolic Links
To get rid of a symbolic link, you can simply delete it like you would any other file or directory. Just be careful to delete the link itself rather than the file or directory it’s linking to.