In today's article we will try to explain Symbolic Links in Windows and give you a complete guide to creating them and their usefulness.
Windows 10, 8, 7, and Vista support them Symbolic Links (or symbolic links in Greek), also known as shortcuts to a file or folder on your system. You can create them using the line orders or a third-party tool, such as the Link Shell Extension.
What are Symbolic Links?
Symbolic Links are basically advanced shortcuts. By creating a symbolic link to a single file or folder in Windows, this link will appear as the file or folder itself, even if it is simply a link that directs you to the file or folder.
For example, suppose you have a program that contains its files in C: \ Program. But you want to save this program to the directory in D: \ Stuff, but the program itself requires its files to be in C: \ Program. You could move the original directory from C: \ Program to D: \ Stuff, and then create a symbolic link to C: \ Program that demonstrates D: \ Stuff. When the program starts, it will try to access its directory in C: \ Program. Windows will automatically redirect it to D: \ Stuff, and everything will work just like it was in C: \ Program.
This trick can be used anywhere, including syncing to any folder with programs like Dropbox, Google Drive, and onedrive.
There are two kinds of symbolic links: Hard and soft. Forgive us English terminology, but some things are now internationally established and their Greek translation does not sound good. Soft Shortcuts work in a similar way to a regular, standard shortcut. When you open a soft shortcut to a folder, you will be taken to the folder where the files are stored. However, a hard shortcut works and it seems like the file itself or the folder actually exists in place of the symbolic link. This feature makes hardcore shortcuts more useful in most cases.
Note that Windows does not use the terms "hard link" and "soft link". Instead, they use the terms “hard link” and “symbolic link”. In Windows, a "symbolic link" is the same as a "soft link". The mklink command can create both hard links and soft links (known as a "symbolic link" in Windows).
How to create a shortcut with mklink
You can create symbolic links by using the mklink command from a command line window with admin permissions. To open such a window, press Win + X at the same time and from the popup menu select "Command Line".
Without any extra option, the mklink command creates a shortcut to a file. The following command creates a soft link to the file named Target: mklink Link Target
Use the / D switch if you want to create a soft link that links to a directory. Like this: mklink / D Link Target
Using / H is done when you want to create a hard link that references a file: mklink / H
Link Target
Use the / J switch to create a hard link that references a directory, also known as the junction directory: mklink / J Link Target
For example, if you want to create a hard link in C: \ LinkToFolder to connect to C: \ Users \ Name \ OriginalFolder, you should run the following command:
mclink / JC: \ LinkToFolder C: \ Users \ Name \ OriginalFolder
You should put quotes if the folder names have spaces. For example, if the folders are named C:\Link to Folder and C:\Users\Name\Original Folder, your command should be:
mklink / J "C: \ Link to Folder" "C: \ Users \ Name \ Original Folder"
If you see the message "You do not have sufficient privileges to perform this function", you will need to restart the command prompt as an administrator.
How to Delete a Symbolic Link
To get rid of a symbolic link, you can just delete it as you would with any other file or directory. Just be careful to delete the shortcut itself rather than the regular file or directory that is linked.