winSxS文件清理,转自微软官网

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

https://answers.microsoft.com/en-us/windows/forum/windows_7-performance/dism-cleanup-image-not-working/e4611720-6add-4040-be9f-40516369d629

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

One commonly asked question is can I delete the WinSxS folder to regain some disk space? The short answer is no. However, there are ways to reduce the size of the WinSxS folder. For more information about the WinSxS folder, see Manage the Component Store. This topic was written to provide information about the different ways to reduce the size of the WinSxS folder on a running version of Windows 8.1.

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.

You can also reduce the size of a Windows image using some of the same techniques, as discussed in Reduce the Size of the Component Store in an Offline Windows Image.

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

  1. If Task Scheduler is not open, start the Task Scheduler. For more information, see Start Task Scheduler.

  2. Expand the console tree and navigate to Task Scheduler Library\Microsoft\Windows\Servicing\StartComponentCleanup.

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

Deployment Image Servicing and Management (DISM) is a command-line tool that allows you to install, uninstall, configure, and update Windows features, packages, drivers, and international settings. The /Cleanup-Image parameter of Dism.exe provides advanced users more options to further reduce the size of the WinSxS folder. For more information, see DISM Operating System Package Servicing Command-Line Options.

Use the /StartComponentCleanup parameter

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

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

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

  1. To delete system files run the steps as provided in Delete files using Disk Cleanup.

See Also

Tasks

Determine the Actual Size of the WinSxS Folder
Reduce the Size of the Component Store in an Offline Windows Image

Concepts

Manage the Component Store

Other Resources

Uninstall-WindowsFeature
How to Reduce the Size of the Winsxs directory and Free Up Disk Space on Windows Server 2012 Using Features on Demand
How to address disk space issues that are caused by a large Windows component store (WinSxS) directory

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 220,063评论 6 510
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,805评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 166,403评论 0 357
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,110评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,130评论 6 395
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,877评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,533评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,429评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,947评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,078评论 3 340
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,204评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,894评论 5 347
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,546评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,086评论 0 23
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,195评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,519评论 3 375
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,198评论 2 357

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,338评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,524评论 0 23
  • 星期五,陈老师的数学课。测试练习,口算训练,120道题,我得了满分,我拿到了第二名,还拿到了一个成长币,,这件事对...
    我是王俊哲阅读 168评论 3 1
  • 拾荒人没有听觉 不懂得什么是嘲笑 拾荒人的眼角是向下的四十五度 卑贱的四十五度 听别人说拾荒人以前不是这样的 拾荒...
    e3f0f532d0d9阅读 189评论 0 0
  • 在最近热播的历史正剧《大秦帝国之崛起》中,暮年的宣太后羋月回顾她的四个男人,对她的小鲜肉情人魏丑夫感慨万端,也对自...
    燕尾无声阅读 4,484评论 1 4