[In-depth] Symbolic links and their various uses in Windows

Avatar

Symbolic Folder

Shortcuts in Windows are fairly easy to understand. You take a file and point it to a specific direction in order to run programs or gain quick access to certain folders. For instance, instead of going to the Skype folder every time you want to chat with someone, you have a Skype shortcut on your desktop which opens the file located in the original directory. Since this is the most basic form of shortcuts, you can think of symbolic links as the advanced versions instead.

Symbolic links explained

Symbolic links, also known as symlinks, come in different varieties. Soft links are virtually the same as shortcuts as they merely point to another direction and let you open folders located in other areas instantly whereas hard links “trick” the system into thinking the linked files are in a different location. Hard links can only be created in the same drive whereas symbolic links can be used across different drives.

To better understand the concept, imagine that you have two different drives, one for Windows (C:) and one for backups, movies, music, and everything else you wish to store (D:). When your Windows drive runs out of space, you will probably want to install games and software on the second drive. The problem is that many apps and games, especially older ones, can run into issues when they are installed outside the system partition. To fix that, you can create a symbolic link that will make it seem as if your games and apps were installed in the “C:” drive and there would be no difference whatsoever.

Symbolic links – Common uses and warnings

There is a huge number of situations where symbolic links can save the day and it really depends on how you want to use your computer. For example, you can create symlinks in OneDrive, Google Drive, Dropbox, and other cloud storage services so that you can keep your files in their original location and sync them on the cloud at the same time. You can consolidate the settings, profiles, and user data from all of your apps into a single location. You can store multimedia files in any drive and have them show up in the default multimedia locations (Music, Pictures, Videos) so that all media players will be able to detect them instantly.

There are plenty of other uses which you can explore once you are more familiar with symbolic links. The only thing I would like to note is that you must never create symbolic links inside symbolic links as this might lead to an infinite loop which you do not want to deal with. Furthermore, you should always make sure that files and folders you link to symbolically are not in use by other applications at that time.

Symlink Creator

There are plenty of applications that can help you create symbolic links and they are all more or less the same. My favorite one so far has been Symlinker as it is incredibly simple and can be used by anyone. I would suggest downloading the Standalone Executable as it will allow you to run the app without installing anything.

Symbolic Link Creator Blank

Once you run Symlinker/Symlink Creator, you will see a variety of fields that you need to fill out. First of all, select whether you want to link a file or a folder via the dropdown menu at the top. Then, select the folder where you want to place your link. In the “Now give a name to the link” field, enter the name of the folder or file you want to create. In the Destination Folder field, enter the path to the actual folder you want to link. Finally, select the type of link from the dropdown menu at the bottom and click on the “Create Link” button to produce your very first symbolic link.

As an example, say that I want to link my entire music collection, which I have stored on my HDD, to the actual music library in Windows, which is hosted on the system partition. To do that, here is what your settings would look like in Symlinker.

Symbolic Link Creator

Once you get the gist of it, linking files and folders will become incredibly easy so do not worry if you get a couple of things wrong the first few times.

Link Shell Extension

Another incredibly easy and useful tool that uses Windows/File Explorer and the context menu (right-click menu) for all your symlink needs. Start by visiting the Link Shell Extension Downloads section. Before downloading the Link Shell Extension, you must first download the VCRedist packages via the provided links. Make sure you download the correct one (x64 or x86 for 32-bit systems) and then install the extension like any other app. When the installation is over, you will be asked to restart Windows Explorer. Do it immediately otherwise the Link Shell Extension will not work until you either restart Explorer or your system.

Once everything is finished, right-click on a file or folder and you will see a new option that reads “Pick Link Source”. This simple little option allows you to pick the original folder like we saw before with Symlinker. After copying the link source, head over to the secondary location, right-click on an empty space and select the “Drop as…” option. Link Shell Extension offers a lot more options for various types of symlinks but you should stick with the simple ones for now.

Link Shell Extension Context

Another way to use the extension, which happens to be even easier, is to drag and drop files with the right mouse button. Doing so usually allows you to choose between copying, moving, or linking the selected files and folders but you will now get the option of instantly creating symbolic links as well. Using our previous example once again, you could highlight your Music folder in one drive, drag and drop it to a new location with the right mouse button and select the Drop Here > Symbolic link option.

The command line

One thing I did not mention before is that all of these apps actually take advantage of built-in CMD commands in order to complete their operations. Of course, something like Link Shell Extension can complete advanced operations faster and easier than you would do manually so there is little incentive to use CMD as a casual user, unless you want to learn more about the command prompt and its various uses.

To start with, you will need an elevated command prompt window. In Windows 8.x and 10, right-click on your Start menu’s icon and select the “Command Prompt (Admin)” option. In Windows 7, open your Start menu, type cmd.exe, right-click on the first result and choose to “Run as administrator”. TO create a symbolic link, this is the template you want to use:

mklink /Parameter LinkPath TargetPath

e.g. mklink /d  “C:\Users\Adam\Music Collection” D:\Music

Mklink CMD

Note that I used quotation marks for the first path because it contains a space and CMD needs to recognize it as a full path instead of a new command. Also note that the first path is the symbolic link whereas the second path is the real folder.

As for the parameters, here is a full list and a brief description:

/d > Creates a directory symbolic link. The default mklink command creates file symbolic links.

/h > Creates hard links.

/j > Creates directory junctions. A type of link that can only be used for directories, and never on a remote drive. Stick with symbolic links and you will be fine.

Deleting symbolic links

Because this is a very common question, I would like to clarify that removing symbolic links is as simple as deleting them from File Explorer like any other file or folder. Because these are simply links, the actual files will remain untouched. After deleting a symlink, you can create an identical one immediately.