Symlinks or Symbolic Links is one of the lesser known, yet useful, features in Windows. You can think of symbolic links as the shortcuts you create in Windows. However, symbolic links are much more powerful and helpful than regular shortcuts. Let’s discuss what symbolic links are and how you can easily create them in Windows 10.
What Are Symbolic Links?
When you create a shortcut for a file or folder, all you are doing is pointing it to that specific file or folder, nothing more. Symbolic links are much more than a simple shortcut. They act as a virtual file or folder that links to the actual file or folder.
When you create a symlink for a file, it appears as if it is the actual file when in reality it is redirecting you toward the real file in the background. Besides files, you can also create symlinks for folders. Simply put, a symlink is nothing more than a build of the text string which lets the operating system know that it is just a path for another file or folder.
For instance, most cloud service apps you install will only sync files and folders located in their own folder. But there will be times when you might have a folder in some other drive you want to sync with the cloud storage service.
However, you don’t want to move the folder from its actual location or don’t want to create a copy of the folder. In those situations you can simply create a symlink in the cloud service folder so that you can sync the contents of the target folder without actually moving or copying the real folder.
Since a symlink is just a virtual folder that just acts as a path to the real folder, you don’t have to worry about the symlink consuming your disk space.
Types of Symbolic Links
||points to files or folders on the same or different drive letters. If the target is deleted, then the link is broken and the file or folder is no longer accessible.|
||points to files on the same local drive letter. Does not work with folders. If the target file is deleted, the data at the file link remains accessible. Think carbon copy.|
||also known as directory hard link. Points to directories or folders on different local drive letters. Does not work with files. If the target folder is deleted, the data at the folder link remains accessible.|
1. Create Symbolic Link Using Mklink
Note: Though we’re showing this in Windows 10, the commands shown here are applicable to Windows Vista and up.
Creating symlinks in Windows is pretty easy with the
mklink command. To start, press Win + X, then select the option “Command Prompt (Admin)” to open the Command Prompt with admin rights. If you don't see command prompt with Win + X, you could try another way; press Win + S, then write "Command Prompt", then choose run as administrator from right side.
Once the command prompt has been opened, use the below command format to create a symlink for a file.
mklink Link Target
In our case, we want to create a symlink in the E drive for a text file located on the F drive, so the command looks something like this:
mklink "E:PathSymlink_File.txt" "F:Real_File.txt"
The first path you see in the above command is where you will create your symlink. This path is called a “Link.” The second path belongs to the actual file on your disk and is called “Target.”
Once the symlink has been created, this is how it looks in the File Explorer. Though the icon looks like a regular shortcut, it is a symlink.
Along with individual files, you can create symlinks for entire directories. To do that, use the below command. The switch /D allows you to do this.
mklink /D "E:PathSymlink_Books" "F:Books"
As soon as you execute the command, the symlink will be created for the target directory. You can use it to access all the files and folders inside the real folder. If you ever want to, you can delete the symbolic link like any other file or folder. Just select the symlink, press the delete key on your keyboard, and you are good to go.
And you’re done!
2. Using Link Shell Extension
Link Shell Extension (LSE) is a free graphical tool for creating links. Once installed, you will notice a new “Pick link source” option when you right-click a target file or folder. Click this option to let LSE know that this is the target for the link you are trying to create.
Next, go to the location where you want the link to be created and then right-click again. Choose the “Drop as” > “Symbolic link” option to create the symlink at that location.
3. Using Symbolic Link Creator (Symlinker)
Symbolic link creator is a free and open-source tool for creating links. Though this application is built on an older technology (.Net Framework 3.5 required), it provides a straightforward graphical interface for creating file and folder symbolic links.
We hope that you now have a better understanding of what symbolic links are, as well as why and how you would create one. Even if you do not make use of this feature now, it’s nice to know that it exists and you can start to think of different other ways to take advantage of it later.
„Fun fact: when Microsoft asked their users what they wanted added to Office, they found 90% of the requested features were already there.“