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. This tutorial discusses what symbolic links are and shows how you can easily create them in Windows.
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 may be times when you 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.
Create Symbolic Link Using Link Shell Extension
If you don’t want to faff around in the Command Prompt and are prepared to faff around a little bit by installing a tool that lets you create symlinks to an existing file or directory using the right-click context menu, then try the following. Link Shell Extension is a tool that lets you create hard links and symbolic links by right-clicking whatever folder you want to create a link to.
There are a few hoops with the installation. You’ll get a warning that it can’t be downloaded securely, and Windows Defender may warn you that it’s “unsigned.”
We can assure you that the tool is safe. Go ahead and install it. During installation, explorer.exe will restart, so make sure you have important stuff backed up.
- Once LSE is installed, right-click the target file or folder you want to create a symlink to, then click “Pick Link Source.”
Note: in Windows 11, you’ll have to click “Show more options” first before you will see “Pick Link Source” or any of the other right-click menu options below.
- Go to the folder where you want the symlink to appear, right-click it, then select “Drop As -> Symbolic Link.”
Create Symbolic Link Using Mklink
Note: although these instructions are shown using Windows 11, the commands shown here are applicable for Windows Vista and later.
- Creating symlinks in Windows is pretty easy with the
mklinkcommand. To start, press Win, then search for “Command Prompt.” Right-click on “Command Prompt” in the results, then select “Run as administrator” to open the Command Prompt with admin rights.
- Once the command prompt has been opened, use the below command format to create a symlink for a file.
mklink Link Target
- In my case, I want to create a symlink in the C: drive for a text file located on the F: drive, so the command looks something like this:
mklink "C:\Path\Symlink_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
/Dallows you to do this.
mklink /D "C:\Path\Symlink_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.
Frequently Asked Questions
Why am I getting an error when I try to install links shell extension?
You most likely do not have the right Microsoft Visual C files installed on your computer, probably when using Windows 11. Download and install the 64-bit or 32-bit runtime DLLs from the same page you downloaded Link Shell Extension, then try installing it again.
Why can't I use Powershell instead of Command Prompt?
PowerShell is now the default terminal in Windows 11, but unfortunately, it does not work with the
mklink command, so you’ll have to fall back on the trusty Command Prompt.
Why can't I create a symlink in the root of the C: drive?
You can only create folders in the root of the C: drive, assuming that “C” is your system drive. To create symbolic links on this drive, you must make a folder for them first.
Image credit: Pexels. All screenshots by Sydney Butler.
Our latest tutorials delivered straight to your inbox