28

Space on my SSD is running pretty low, and there seems to be a 19GB folder in Windows that sticks out (%windir%\Installer) and cannot be safely deleted (as explained here: https://serverfault.com/q/15746).

Now, the mklink provides a neat little thing called Junction links - if I boot in cmd prompt, and move all of the files to the other hard drive, and then run this:

mklink /J C:\Windows\Installer D:\Windows\Installer

Will I be messing up my Windows in some way, or is this an OK thing to do? Will folder permissions/attributes stay the same across the link?

I've used hard links before, and it worked like a charm freeing up my SSD significantly, but I've never tried it on system folders (I don't see why it wouldn't work, but I'm not in the mood of reinstalling entire windows in case I'm wrong)

1
  • It will be messing. I did exactly this and after software like Ramdisk failed to install. Same with mklink /J and /D, only moving folder back to c let me finish install. Possibly also my windows updates had issues.
    – Cmazay
    Dec 2, 2019 at 15:41

5 Answers 5

36

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:

  1. 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)
  2. 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
  3. 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.

5
  • does this work in windows 10? Oct 15, 2015 at 8:29
  • It should - all of the info still applies AFAIK. If you try it let us know how it went!
    – veljkoz
    Oct 15, 2015 at 10:36
  • 1
    Worked on Windows 7! Nov 2, 2017 at 21:50
  • 3
    Please be aware that this might cause problems when installing major Windows updates (such as Windows 10 Fall Creators Update) because the junction will be replaced with an empty folder.
    – 0xA3
    Nov 22, 2017 at 9:57
  • Didn't work on Win7 with junction: I ran a program installer after moving. It took more than usual and then I saw why: Windows deleted all the files below C:\Windows\Installer and replaced the junction with a normal folder containing just the recent files. The installer was: PatchCleaner_1.4.2.0.exe.
    – basin
    Mar 16, 2018 at 7:24
3

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:

  1. Replace drive letters of paths listed at HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion (for example C:\Program Files\Common Files would become D:\Program Files\Common Files)
  2. Replace environment variables %SystemDrive% with drive path at HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/ProfileList (i.e. %SystemDrive%\ProgramData would become D:\ProgramData)
1
  • 1
    Note: any already installed apps may still look in the old location if their configuration/registry entries point to a location that was resolved before this change. Reinstall of those apps may fix the issue.
    – TWiStErRob
    Jun 11, 2017 at 20:21
3

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).

2
  • 1
    if you don't want hibernation, turn it of with powercfg -h offinstead. Using links on these files sounds like a sure receipt for disaster
    – NiKiZe
    Feb 15, 2019 at 12:05
  • Why bother moving/liningk swap with its TEMPORARY content that you don't want to preserve if you can simply disable it on one drive and enable on another? Sep 21, 2019 at 13:07
2

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).

  1. Manually copy the folder to F:\Installer
  2. I am using Windows 8.1, so to get to a command line boot I held Shift while I clicked Restart, then clicked Advanced
  3. 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
  4. I removed the hidden and system attributes on E:\Windows\Installer with attrib -s -h E:\Windows\Installer and renamed it with rename "E:\Windows\Installer" "Installer_old"
  5. I could then create the junction with mklink /J E:\Windows\Installer F:\Installer
1
  1. Copy C:\Windows\Installer to another disk such as D:\C\Windows\Installer.
  2. Check and compare sizes of both folders if the source directory on C: has not been changed during copying.
  3. Rename folder on disk C:, e.g. Installer => InstallerX
  4. Run the command as an admin and launch run this command:
    • mklink /d C:\Windows\Installer D:\C\Windows\Installer
  5. Wait some time (few day) if everything is OK.
    • If yes, you can delete backup the folder C:\Windows\InstallerX.
    • If no, delete symbolic the folder C:\Windows\Installer and rename back InstallerX to Installer, or copy back the folder D:\C\Windows\Installer to C:\Windows\Installer.
1
  • 1
    This duplicates another answer and adds no new content. Please don't post an answer unless you actually have something new to contribute.
    – DavidPostill
    Apr 20, 2016 at 8:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .