Go to ...

Techpository

A Better Technical Repository

RSS Feed

Windows 7: Using mklink to move folders and programs to another drive


Symbolic links can be created in the command line with a special command that was first introduced in Vista. It is called Mklink  and here is how it works for a folder:

  1. Before doing anything, make sure you have a backup of your system
  2. Move (not copy) the desired folder (let’s call it ExistingName) by the usual methods to its new destination on the X: volume. Give it whatever name you choose. Let’s call it NewName but it can retain ExistingName if you wish.  At this point programs and Registry references may be broken. It is necessary to move the folder first since otherwise no symbolic link can be created on the C. drive
  3. Next open a command prompt with elevated privileges.
  4. Enter the command mklink /d C:ExistingName X:NewName The switch /d indicates that we are linking folders (directories). No switch would be used if a file was being linked. If your folder name has spaces, you have to enclose the path name in quotes.
  5. If a link is successfully made, the command line will show a message “symbolic link created for ExistingName <<===>> X:NewName”.
  6. Close the command prompt

That’s all it takes. All of the previous Registry or other references to C:ExistingName will continue to work. The command creates a small object on the C: drive that retains the previous folder name and behaves as if it has the contents of the folder that is really over on the X: drive.

By: V. Laurie