Moving Windows folders around with Junction links (mklink)
Solution 1:
OK, I've taken the risk and it was worth it - everything works normally, but I have freed the 17GB on my SSD now.
Basically, the steps are:
- Restart your PC, press F8 continuously to bring up boot menu, and choose "Command prompt with safe mode" (this is to ensure you can move the windows folder around)
- Once the command prompt is shown, type the command to move the folder to another drive:
robocopy C:\Windows\Installer D:\Windows\Installer /MOVE /e
- Next, create a "Junction" link for the missing folder:
mklink /J C:\Windows\Installer D:\Windows\Installer
Of course, this assumes that your %WINDIR% is C:\Windows, that your D drive is the one with more space, that you want your destination in "D:\Windows\Installer" (it could be any folder, just be consistent) etc...
This should do the trick.
Solution 2:
While attempting to reclaim space on my main drive, an 120GB SSD, I found these instructions on how to relocate Users
, Program Files
, Program Files (x86)
, and ProgramData
. It includes some registry edits "to set default locations", as follows:
- Replace drive letters of paths listed at HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion (for example
C:\Program Files\Common Files
would becomeD:\Program Files\Common Files
) - Replace environment variables
%SystemDrive%
with drive path at HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/ProfileList (i.e.%SystemDrive%\ProgramData
would becomeD:\ProgramData
)
Solution 3:
I took similar steps, but I wanted to be able to use my computer while I did the file copy (my folder was 40 GB).
- Manually copy the folder to F:\Installer
- I am using Windows 8.1, so to get to a command line boot I held Shift while I clicked Restart, then clicked Advanced
- Once in the command line, I had to figure out which drive letter to use (it wasn't C: even though that is my %SystemDrive% when my OS is fully booted). I had to use
echo list volume | diskpart
to find out that the C: drive was now referred to as E: and the F: drive was still the F: drive - I removed the hidden and system attributes on E:\Windows\Installer with
attrib -s -h E:\Windows\Installer
and renamed it withrename "E:\Windows\Installer" "Installer_old"
- I could then create the junction with
mklink /J E:\Windows\Installer F:\Installer
Solution 4:
You can use same trick for pagefile.sys and swapfile.sys (not sure if also for hiberfile.sys, not tested since i hate hibernating on multi-boot).
Just ensure to deactivate virtual ram and reboot prior to create the symlinks, then after creating them reactivate virtual ram.
I tend to create (with notepad) an empty file on destiny of the link prior to create the link.
Remember: When Windows10 UpGrade it will remove the links and put real files, after UpGrades you can repeat the process.
Working upto Windows 10 version 1803.48, since WindowsXP (oldest i had tried).