When we install a large program on Windows, links are created in the registry that help keep track of the real location of the executable files.
For this reason, if we move a program to a secondary partition, it will stop working (the links will stop running).
How do you ensure the continuity of these links?
This is done with Junctions or Symbolic Links.
The mklink command makes Windows believe that the files in the folder are all stored in the original path, when in fact they have been moved to an external partition.
How to do it
1.Select the folder containing the software to be moved and proceed with this operation.
2.Create a ‘symbolic link’ by opening a command prompt with administrator rights.
The mklink command allows access requests for files in the directory that originally contained the application files which will automatically be redirected to the target folder (the one they’re really in).
3.Run the command:
mklink /D "folder as symbolic link" "folder really containing files"
Example (after moving program pippo from C: to D:):
mklink /D "C:\Program files\pippo" "D:\App\pippo"
In this way:
- All references to the old ‘pippo’ folder in C: will remain valid, the files will be ‘fished’ from D:, they will not really be present in C:
- All moving, copying, deleting operations will affect the real directory (in D:).
How to see photos from an external drive in the Photos folder in windows
cd %userprofile%\Photos (to enter in Windows’ pictures folder) mklink /D Photos G:\Photos
How to see the Video folder that is on a network drive in the Public Video folder in C:
cd C:\users\public\video mklink /D NetworkVideo \\NetworkDisk\Video
How to create a folder on the Desktop and see it on OneDrive
cd C:\users\<username>\OneDrive mklink /D SharedFolderFromDesktop C:\users\<username>\Desktop\SharedFolder
With this command you will be able to see the list of all the junctions or links made or present in a folder.
Before using it, go to the folder to verify.
Alternatively there are programs such as: NTFSLinksView of NirSoft:
mklink /J ...generates a ‘junction’ mklink /D ...generates a ‘symbolic link’
The main difference is that junctions can also be created on individual files but they do not support relative paths (symlinks only on folders but they also support relative paths); basically I prefer and recommend using symlinks on folders.
use the commands:
mklink ...for Windows 7 - 8 - 10 linkd ...for Windows XP – 2000