The component store cannot reside on a volume other than the system volume because of the NTFS hard links. If you try to move the component store, this will result in the inability to correctly install Windows updates, service packs, roles, or features. Additionally, we do not recommend that you manually remove or delete files from the component store.
To reduce the size of the component store directory on a Windows installation, you can decide to make the service pack installation permanent and reclaim used space from the service pack files. However, if you make the service pack installation permanent, the service pack is not removable.
To remove the service pack files from a Windows installation, use the following in-box utilities:
Windows Vista Service Pack 1 installed: VSP1CLN.EXE
Windows Vista Service Pack 2 or Windows Server 2008 Service Pack 2 installed: Compcln.exe
Windows 7 Service Pack 1 or Windows Server 2008 R2 Service Pack 1 installed: DISM /online /Cleanup-Image /SpSuperseded or Disk Cleanup Wizard (cleanmgr.exe)
Scavenging may also be performed proactively on Windows Vista and Windows Server 2008 installations by forcing a removal event on the system. Scavenging will try to remove any unwanted system binaries from the installation and enable Windows to reclaim the disk space. To issue an uninstall event on a Windows installation, add and remove any unwanted system component that is not already installed, and then restart the Windows installation. Scavenging will be performed during the following restart of the operating system.
备注: windows2008 需要这个:dism /Online /Cleanup-Image /spsuperseded
Clean Up the WinSxS Folder
- <time role="presentation" datetime="2014-02-10T00:00:00.000Z" data-article-date-source="ms.date" style="box-sizing: inherit;">02/10/2014</time>
- 4 minutes to read
Applies To: Windows 8.1, Windows Server 2012 R2
Windows 8.1 and Windows Server 2012 R2 automatically reduces the size of the WinSxS by using methods similar to the ones described in this topic, however these methods also include internal processes, such as uninstalling and deleting packages with components that have been replaced by other components with newer versions. Previous versions of some components are kept on the system for a period of time, allowing you to rollback if necessary. After a period of time, these components are removed from the installation.
Warning
Deleting files from the WinSxS folder or deleting the entire WinSxS folder may severely damage your system so that your PC might not boot and make it impossible to update.
In Windows 8.1 and Windows Server 2012 R2, you have a number of ways to start the cleanup of the component store, which use a combination of package deletion and component compression to clean up the WinSxS folder:
Task Scheduler
The StartComponentCleanup task was created in Windows 8 to regularly clean up components automatically when the system is not in use. This task is set to run automatically when triggered by the operating system. When run automatically, the task will wait at least 30 days after an updated component has been installed before uninstalling the previous versions of the component.
If you choose to run this task, the task will have a 1 hour timeout and may not completely clean up all files.
Run the StartComponentCleanup task in Task Scheduler to clean up and compress components
-
Expand the console tree and navigate to Task Scheduler Library\Microsoft\Windows\Servicing\StartComponentCleanup.
-
Under Selected Item, click Run
Note
The StartComponentCleanup task can also be started from the command line:
schtasks.exe /Run /TN "\Microsoft\Windows\Servicing\StartComponentCleanup"
Dism.exe
Use the /StartComponentCleanup parameter
-
Using the /StartComponentCleanup parameter of Dism.exe on a running version of Windows 8.1 gives you similar results to running the StartComponentCleanup task in Task Scheduler, except previous versions of updated components will be immediately deleted (without a 30 day grace period) and you will not have a 1-hour timeout limitation.
From an elevated command prompt, type the following:
Copy
Dism.exe /online /Cleanup-Image /StartComponentCleanup
Use the /ResetBase switch with the /StartComponentCleanup parameter
-
Using the /ResetBase switch with the /StartComponentCleanup parameter of DISM.exe on a running version of Windows 8.1 removes all superseded versions of every component in the component store.
From an elevated command prompt, type the following:
Copy
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
Warning
All existing service packs and updates cannot be uninstalled after this command is completed. This will not block the uninstallation of future service packs or updates.
Use the /SPSuperseded parameter
-
To reduce the amount of space used by a Service Pack, use the /SPSuperseded parameter of Dism.exe on a running version of Windows 8.1 to remove any backup components needed for uninstallation of the service pack. A service pack is a collection of cumulative updates for a particular release of Windows.
From an elevated command prompt, type the following:
Copy
Dism.exe /online /Cleanup-Image /SPSuperseded
Warning
The service pack cannot be uninstalled after this command is completed.
Disk Cleanup
You can use Disk Cleanup to reduce the number of unnecessary files on your drives, which can help your PC run faster. It can delete temporary files and system files, empty the Recycle Bin, and remove a variety of other items that you might no longer need. The option to cleanup updates helps reduce the size of the component store.
Run Disk Cleanup to delete system files
- To delete system files run the steps as provided in .