Can I delete the folder "C:\WINDOWS\Installer\$PatchCache$"?

127

25

This folder is taking up nearly a GB of my C partition. Is it possible to just delete it?

James

Posted 2009-12-13T07:17:03.927

Reputation: 1 421

Answers

53

I think it should be safe to remove the files, provided you're able to download them again in future if they're needed or if you have access to your original install disks. I had something similar on my computer, I just deleted it and install things from the original disk every time it asks me now. Inconvenient, yeah; but I don't often install stuff and it's a lot better than having a whole ton of space on my hard drive wasted.

mechanarchy

Posted 2009-12-13T07:17:03.927

Reputation: 757

9It's recommended at least to compress C:\WINDOWS\Installer\$PatchCache$ or the full C:\WINDOWS\Installer folder. The simple step can save really much space on the disk. There are exist many msp files which are not use cab inside. Such msp files can be good compressed and one get some disk space for free. – Oleg – 2015-05-18T08:40:35.893

1

Reading the command line options for msizap, I wonder if manually deleting these files is indeed safe. Like for msizap * Microsoft writes: Removes all Windows Installer folders and registry keys, adjusts shared DLL counts, and stops Windows Installer service. Also removes the In-Progress key and rollback information. Does Windows also do this when manually deleting the files? (Do not run msizap without understanding what it does; see comments at Joshua's answer.)

– Arjan – 2010-12-02T08:26:37.413

Yeah, C:\WINDOWS\Installer$PatchCache$ on my hard drive is empty, so I guess if it's safe for me it should be safe enough for you. – mechanarchy – 2009-12-13T07:42:32.947

3I'll try to move it and see what happens – James – 2009-12-13T08:21:46.347

59

Heath Stewart's The Patch Cache and Freeing Space on MSDN blogs explains in detail. An excerpt:

[..] cause the Windows Installer service to cache any of the original files being replaced into the baseline cache. [..] It is this baseline cache that consumes a lot of drive space on the system drive after installing [..] The baseline cache facilitates patch uninstall by storing the original files so that they can be copied back to the target locations.

[..] by removing the baseline cache for a product, future repair, patch install, and patch uninstall scenarios may require your original installation media. If you have the drive space it is recommended that you keep the baseline caches available.

Orangutech

Posted 2009-12-13T07:17:03.927

Reputation: 813

Note that he mentions that you should only remove some sub-folders from $PatchCache$\Managed\. For me I removed MS Office folders as they were taking a lot of space and I have DVD for them. You should be able to easily recognize MS Office folders as they have files with MS Office icon in there. – Nux – 2015-01-13T15:35:56.793

thanks for this - I moved the whole folder off onto a memory stick and rebooted and all was well. Saved me over 2GB (Win 7 x64) – user765827 – 2015-05-01T09:33:59.753

Heath also explicitly said in a comment to his post that "you can delete %windir%\installer$patchcache$. This may cause you to get source prompts for binary delta patches as well as during patch uninstall, but is otherwise okay. You must not delete any files directly under %windir%\installer, though. This will prevent you from repairing, patching, or even uninstalling products that use those files no matter what the type." – Holistic Developer – 2015-05-20T14:50:21.257

15

You could also try the MSIZAP utility from Microsoft. It has a "safe" option, 'G'.

Joshua Drake

Posted 2009-12-13T07:17:03.927

Reputation: 284

@mattwilkie that link is dead – Shanteva – 2016-09-19T17:26:13.427

@novaterata https://support.microsoft.com/en-us/help/17588/fix-problems-that-block-programs-from-being-installed-or-removed appears to be working.

– Joshua Drake – 2016-09-19T19:40:57.490

JoshuaDrake thanks! Nobody does dead links like MSFT. @mattwilkie how do you replicate the behavior of MSIZAP /G with this tool? – Shanteva – 2016-09-19T19:49:56.617

6

Nice. But according to the article mentioned by Scandalon: Take care when using msizap, though. "G!" is safe, but exploring other switches without understanding their ramifications could mean you cannot patch products anymore because product registration is missing (essentially making it appear to Windows Installer that your product is not there). Treat this like editing the registry.

– Arjan – 2010-12-02T08:19:12.383

1I tried running this on Win7 (my folder's 9.2GB) and saw no reduction in disk usage. Is msizap still needed with Win7? – Drew Noakes – 2012-04-17T23:48:41.857

@DrewNoakes if you used the "safe" option, then I am going to guess that those files were all considered necessary. – Joshua Drake – 2012-04-18T13:57:15.383

7"MSIZAP and MSICUU2 are no longer supported because they have been found to cause problems. Please use the Program Install and Uninstall troubleshooter available here: http://support.microsoft.com/kb/2438651" -- 11/22/2011, Jeff Ingalls MSFT – matt wilkie – 2012-11-02T17:33:13.453

3@mattwilkie You may want to include that as an answer too. – Joshua Drake – 2012-11-02T18:27:05.100

8

What I do for this folder is revisit it every now and then and only delete packages in there that are at least six months old. This way, if there's a bad patch that I need to roll back, I can usually still do it.

Joel Coehoorn

Posted 2009-12-13T07:17:03.927

Reputation: 26 787

3

If in doubt, you can always go safer way: simply compress entire Installer map! Right click on the Installer map (or just $PatchCache$ map) and choose Properties. On General tab, click Advanced button. Finally, check Compress folders to save disk space. If asked, choose an option to compress all subfolders and files.

This way you can gain up to 30% of free space (or in your case, nearly 300MB), and you keep everything in case you'll need this stuff later on. And system speed and response wont be affected much since system rarely accesses this map.

You can apply this tactic to several other non-essential system maps, thus recovering lots of free space on your drive!

Kaidan Alenko

Posted 2009-12-13T07:17:03.927

Reputation: 31

3

Is it possible? Yes. Should you? Probably not, if you don't have to. Windows Installer keeps those files around because it think they're needed if you ever have to install another patch on top of them (or uninstall those particular patches).

Jimmy

Posted 2009-12-13T07:17:03.927

Reputation: 1 159

1

You can delete the folder content.

Follow these steps:

1) Stop Windows Installer the service.

2) Set the registry key that indicates the maximum folder size to zero.

3) Delete folder content.

4) Start Windows Installer the service.

5) Stop Windows Installer the service.

6) Set the registry key that indicates the maximum folder size to 10 (default).

7) Start Windows Installer the service.

Example:

Net Stop msiserver /Y

Reg Add HKLM\Software\Policies\Microsoft\Windows\Installer /v MaxPatchCacheSize /t REG_DWORD /d 0 /f

RmDir /q /s %WINDIR%\Installer\$PatchCache$

Net Start msiserver /Y

Net Stop msiserver /Y

Reg Add HKLM\Software\Policies\Microsoft\Windows\Installer /v MaxPatchCacheSize /t REG_DWORD /d 10 /f

Net Start msiserver /Y

Extracted from:

http://www.sysadmit.com/2016/02/GPO-Reducir-tamano-C-Windows-Installer.html

Delimstwo

Posted 2009-12-13T07:17:03.927

Reputation: 11

0

Instead use MKLINK to junction the folder to an alternate drive if you have space

• on drive D: create sub folder named C

• cut and paste folder Installer to subfolder C-Windows located on drive D:

• run CMD

• type: CD C:\Windows

• type: MKLINK /J Installer D:\C-Windows\Installer

• type: EXIT

Santanu Saha

Posted 2009-12-13T07:17:03.927

Reputation: 1

-1

The solution is to use the command from Start → Run → cmd:

rmdir /q /s "C:\WINDOWS\Installer\$PatchCache$" 

Warning: This will not affect the Installer folder. All content msi files created there will remain until the program is uninstalled. $PatchCache$ can grow up to GB of size which takes a lot of my hard disk space.

This command will delete $PatchCache$, and after you finish, run

dir C:\WINDOWS\Installer\$PatchCache$

… to see if the folder is still there.

You can also use

del /q /s %tmp%

which deletes all files in the temporary folder, which are created by installing software.

Michael Birchall

Posted 2009-12-13T07:17:03.927

Reputation: 23

IMHO your answer is irritating, since it does not address the original concern whether it is safe, but instead provides a details "step-by-step" intro that suggest that it's totally safe to do everything you write - this is misleading and may cause potential readers a headache in the future. – Daniel Albuschat – 2015-11-02T06:46:45.607

13I assume the user knows how to delete the files in a folder. The question is whether it's safe to do so. – D Coetzee – 2012-04-22T07:24:36.920