# 磁盘清理

**磁盘清理**（Disk Cleanup）是[微软 Windows](https://www.edgepedia.org/zh/microsoft-windows) 的内置实用工具，以 Cleanmgr.exe 启动，通过扫描驱动器并删除用户所选类别中的文件来回收硬盘空间，这些类别包括临时文件、回收站内容、传递优化文件和已被取代的 [Windows 更新](https://www.edgepedia.org/zh/windows-update)组件等。它在 [Windows 11](https://www.edgepedia.org/zh/windows-11) 中仍然存在，尽管微软现在将其视为旧版工具，并推荐以“设置”应用中的“存储”设置作为其继任者。<sup>[1](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr)</sup><sup> • </sup><sup>[2](https://www.techtarget.com/enterprise-software/tip/How-to-use-Disk-Cleanup-in-Windows-11)</sup><sup> • </sup><sup>[3](https://windowsnews.ai/article/windows-11-24h2-storage-changes-modern-tools-replace-disk-cleanup.343726)</sup>

| 关键事实 | 详情 |
|---|---|
| 可执行文件与开关 | Cleanmgr.exe 接受 /d、/sageset:n、/sagerun:n、/TUNEUP:n、/LOWDISK、/VERYLOWDISK 和 /autoclean，并可通过任务计划程序工具进行计划<sup>[1](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr)</sup> |
| 默认勾选的类别 | 在基本扫描中，已下载的程序文件、Internet 临时文件和缩略图是预先选中的<sup>[4](https://support.microsoft.com/en-us/windows/free-up-drive-space-in-windows-85529ccb-c365-490d-b548-831022bc9b32)</sup> |
| 管理员模式 | “清理系统文件”以提升的权限重新运行扫描，并添加 Windows 更新清理和以前的 Windows 安装等系统类别<sup>[4](https://support.microsoft.com/en-us/windows/free-up-drive-space-in-windows-85529ccb-c365-490d-b548-831022bc9b32)</sup><sup> • </sup><sup>[5](https://thehightechsociety.com/windows-disk-cleanup/)</sup> |
| 典型释放空间 | 在从未清理过的机器上执行基本运行可清除几百兆字节到几吉字节；在功能更新之后，更新清理加上 Windows.old 通常可达数吉字节或两位数<sup>[5](https://thehightechsociety.com/windows-disk-cleanup/)</sup> |
| WinSxS 下限 | 一份报告称，全新安装的 Windows 11 其组件存储约为 8–9 GB<sup>[6](https://kleaner.pro/en/blog/disk-cleanup-vs-dism)</sup> |
| 继任者 | 存储感知于 2018 年随 Windows 10 版本 1803 引入，在系统驱动器上自动运行；Windows 11 24H2 不再将 cleanmgr.exe 用作默认界面<sup>[5](https://thehightechsociety.com/windows-disk-cleanup/)</sup><sup> • </sup><sup>[7](https://support.microsoft.com/en-us/windows/experience/storage-filemanagement/manage-drive-space-with-storage-sense)</sup><sup> • </sup><sup>[3](https://windowsnews.ai/article/windows-11-24h2-storage-changes-modern-tools-replace-disk-cleanup.343726)</sup> |

## 工作原理

在未提升权限的情况下启动时，图形界面包含“清理系统文件”选项，该选项以管理员权限重新启动 Cleanmgr.exe 并重新运行扫描，正是这一点解锁了对受保护系统文件的删除。<sup>[4](https://support.microsoft.com/en-us/windows/free-up-drive-space-in-windows-85529ccb-c365-490d-b548-831022bc9b32)</sup><sup> • </sup><sup>[8](https://ss64.com/nt/cleanmgr.html)</sup>

**Windows 更新清理**是最重的类别，其缓慢有特定的机制。雷蒙德·陈（Raymond Chen）在微软 DevBlogs 的“Old New Thing”网站上解释说，该选项执行的操作等同于 `dism /Online /Cleanup-Image /StartComponentCleanup`，俗称“深度清理”：它在组件目录中搜寻不再被引用的组件，绕过自动计划任务的 30 天宽限期及其一小时时间限制。<sup>[9](https://devblogs.microsoft.com/oldnewthing/20200922-00/?p=104252)</sup> 同一轮处理随后用 WofShouldCompressBinaries 检查每个未压缩的操作系统二进制文件，并在值得的情况下，使用 Windows 覆盖筛选器将其压缩到 WofCompressedData 备用数据流中。该筛选器的算法比实时压缩更彻底，解压也很快，但压缩本身开销很大，这解释了清理期间的高 CPU 占用。<sup>[9](https://devblogs.microsoft.com/oldnewthing/20200922-00/?p=104252)</sup>

这一切的目标是位于 %windir%\WinSxS 的组件存储，它是系统上所有组件、清单和文件的集合，组件服务基础设施将每个新组件移入其中并为其分配状态。<sup>[10](https://techcommunity.microsoft.com/blog/askperf/understanding-component-based-servicing/373012)</sup> Windows 也会自行清理此存储：StartComponentCleanup 计划任务在系统空闲时运行，在更新组件安装后至少等待 30 天才移除先前版本，并在自动运行时施加一小时超时。<sup>[11](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/clean-up-the-winsxs-folder?view=windows-11)</sup>

## 文件类别说明

基本扫描涵盖用户级位置。微软的命令行参考文档记录了包括临时安装文件、已下载的程序文件、Internet 临时文件、旧的 Chkdsk 文件、回收站、临时文件、临时脱机文件、脱机文件、压缩旧文件和内容索引器的目录文件在内的类别。<sup>[1](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr)</sup> 例如，临时文件保存程序存储在 Temp 文件夹中的临时信息，程序退出时通常会自行删除。<sup>[1](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr)</sup>

在系统文件模式下运行会添加受保护的类别：Windows 更新清理、Windows ESD 安装文件、传递优化文件、DirectX 着色器缓存、设备驱动程序包、Windows 错误报告和以前的 Windows 安装。<sup>[5](https://thehightechsociety.com/windows-disk-cleanup/)</sup> sageset 类别列表还列出了传递优化文件、诊断数据查看器数据库文件、DirectX 着色器缓存、下载（个人下载文件夹）、缩略图、Windows 更新清理、Windows 升级日志文件和系统错误内存转储文件。<sup>[8](https://ss64.com/nt/cleanmgr.html)</sup>

有些删除操作是不可逆的。勾选“下载”会删除下载文件夹的实际内容，而不是其缓存，回收站和以前的 Windows 安装同样无法从工具内部恢复。<sup>[5](https://thehightechsociety.com/windows-disk-cleanup/)</sup>

## 数据一览

以下数字来自专业指南和独立测试，因此是范围值，而非官方数字。

- 在从未清理过的机器上执行基本运行通常可清除几百兆字节到几吉字节；在 500 GB 磁盘上，许多类别仅释放约 100 MB。<sup>[5](https://thehightechsociety.com/windows-disk-cleanup/)</sup><sup> • </sup><sup>[2](https://www.techtarget.com/enterprise-software/tip/How-to-use-Disk-Cleanup-in-Windows-11)</sup>
- 各类别典型回收量：Windows 更新清理 2–15 GB（一位测试者报告 2–6 GB，另一位报告 2–8 GB）；传递优化文件一份指南称 1–5 GB，另一份称 0.5–3 GB；Internet 临时文件 50–500 MB；临时文件 100 MB–2 GB。<sup>[12](https://itcares.ca/en/blog/disk-cleanup-windows-10.html)</sup><sup> • </sup><sup>[13](https://wisechecker.com/disk-cleanup-misses-gbs-recoverable-space-windows/)</sup><sup> • </sup><sup>[6](https://kleaner.pro/en/blog/disk-cleanup-vs-dism)</sup>
- 以前的 Windows 安装会移除 Windows.old 文件夹，在功能更新后可能占用 10–25 GB；Windows ESD 安装文件存在时约为 3 GB。<sup>[13](https://wisechecker.com/disk-cleanup-misses-gbs-recoverable-space-windows/)</sup>
- 分母很重要。一份报告称，全新安装的 Windows 11 其 WinSxS 存储约为 8–9 GB；功能更新会使其膨胀 8–12 GB，其中 StartComponentCleanup 可回收大约一半。在一台从未清理过的两年机龄笔记本电脑上，一次磁盘清理总计 12–18 GB，DISM 再增加 2–5 GB。<sup>[6](https://kleaner.pro/en/blog/disk-cleanup-vs-dism)</sup> 一位作者的 DISM StartComponentCleanup 运行通过跳过 30 天宽限期和一小时超时，回收了近 20 GB 被取代的 Windows 更新文件。<sup>[14](https://www.makeuseof.com/disk-cleanup-command-recover-windows-update-files/)</sup>

## 与存储感知、DISM 和第三方清理工具的对比

这些工具在不同的层面运作。磁盘清理在组件存储之上工作，处理临时文件、缩略图、回收站、传递优化残留和 Windows 更新清理；DISM /StartComponentCleanup 在 WinSxS 内部工作，移除被取代的组件版本，这就是 IT 管理员在组件存储本身成为问题时会求助于它的原因。<sup>[6](https://kleaner.pro/en/blog/disk-cleanup-vs-dism)</sup>

**存储感知**是自动化的继任者。在默认设置下，它在设备磁盘空间不足时运行并清理不必要的临时文件，并在一段时间后删除回收站内容；它仅在系统驱动器（通常是 C:）上工作，除非经过配置，否则不会触及下载文件夹或 [OneDrive](https://www.edgepedia.org/zh/onedrive) 及其他云内容。<sup>[7](https://support.microsoft.com/en-us/windows/experience/storage-filemanagement/manage-drive-space-with-storage-sense)</sup> 它默认关闭，不过如果 PC 空间不足且用户从未与存储感知交互过，微软可能会将其开启以管理选定的临时文件，然后通知用户。<sup>[7](https://support.microsoft.com/en-us/windows/experience/storage-filemanagement/manage-drive-space-with-storage-sense)</sup> 实际分工是：存储感知按计划运行，适合日常维护；手动磁盘清理适合一次性深度清理，包括以前的 Windows 安装；在数月未清理或功能更新后不久，Windows 更新清理和 Windows.old 通常合计可释放 10–20+ GB。<sup>[15](https://pcutilityhub.com/disk-tools/disk-cleanup/)</sup>

第三方清理工具包括 BleachBit、CCleaner、Glary Utilities 和 Wise Disk Cleaner；厂商建议从官方网站下载，并在运行磁盘工具前备份。<sup>[2](https://www.techtarget.com/enterprise-software/tip/How-to-use-Disk-Cleanup-in-Windows-11)</sup>

## 历史与近期发展

存储感知于 2018 年随 [Windows 10](https://www.edgepedia.org/zh/windows-10) 版本 1803 推出，此后微软一直引导用户前往“设置 > 系统 > 存储”，其“清理建议”页面将临时文件、大型或未使用的文件、同步到云的文件和未使用的应用分类，显示每次选择节省的空间，还可以压缩操作系统驱动器以为更新腾出空间。<sup>[5](https://thehightechsociety.com/windows-disk-cleanup/)</sup><sup> • </sup><sup>[4](https://support.microsoft.com/en-us/windows/free-up-drive-space-in-windows-85529ccb-c365-490d-b548-831022bc9b32)</sup>

24H2 的转变是近期最具体的变化。在 Windows 11 版本 24H2 中，旧的磁盘清理向导（cleanmgr.exe）不再是默认界面，尽管该可执行文件仍出于兼容性目的存在于系统中；“设置”中的“清理建议”区域改为识别可安全移除的文件——其中包括 Internet 临时文件、传递优化文件和较早的 Windows 安装（Windows.old）——显示大致大小并允许一键删除。<sup>[3](https://windowsnews.ai/article/windows-11-24h2-storage-changes-modern-tools-replace-disk-cleanup.343726)</sup> 第三方报道指出，微软最终可能会移除这一经典工具，因为它希望用户使用“设置”应用中的清理工具。<sup>[16](https://www.ghacks.net/2024/10/10/windows-11-24h2-cleanup-is-no-longer-deleting-all-temporary-files/)</sup> cleanmgr.exe 尚未从 Windows 11 中移除，但它多年未获得界面更新，被视为旧版工具。<sup>[15](https://pcutilityhub.com/disk-tools/disk-cleanup/)</sup>

24H2 时代的两个小插曲值得了解。第一，2024 年 10 月的一份报告称，安装 24H2 升级后的清理保留了超过 8 GB 无法通过“设置”清理工具、经典磁盘清理或 DISM 删除的存储空间。<sup>[16](https://www.ghacks.net/2024/10/10/windows-11-24h2-cleanup-is-no-longer-deleting-all-temporary-files/)</sup> Eleven Forum 上的一项社区测量发现，24H2 上 8.63 GB 的“更新清理”数字是 Windows 组件存储大小计算方式的产物，而非真正可回收的空间，因此两种说法在空间是否真实存在上存在分歧。<sup>[17](https://www.elevenforum.com/t/windows-11-24h2-update-cleanup-space-of-8-63-gb-just-an-artifact.29545/)</sup> 第二，2024 年 8 月的可选更新 KB5044384 修复了影响 Windows 11 版本 23H2 和 22H2 中临时文件大小计算的“存储计算不准确”问题。<sup>[18](https://windowsnews.ai/article/windows-11-storage-bug-fixed-how-kb5044384-restores-trust-in-disk-cleanup.356886)</sup>

## 安全性、风险与自动化

**DISM /ResetBase 选项的操作不可逆。** 它会移除 WinSxS 存储中每个组件的所有被取代版本，此后现有更新包无法卸载；这不会阻止未来更新包的卸载。<sup>[11](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/clean-up-the-winsxs-folder?view=windows-11)</sup> 相关说法称清理组件存储会破坏 Windows 更新，独立测试将其描述为误解。<sup>[6](https://kleaner.pro/en/blog/disk-cleanup-vs-dism)</sup>

真正危险的行为是手动删除。微软警告说，从 WinSxS 文件夹中删除文件或删除整个文件夹可能会严重损坏系统，导致 PC 可能无法启动且更新变得不可能；它不建议手动从组件存储中移除文件，并引导用户使用磁盘清理的更新清理选项来减小组件存储大小。<sup>[11](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/clean-up-the-winsxs-folder?view=windows-11)</sup>

**自动化**使用配对开关。`cleanmgr /sageset:n` 打开一个对话框，其类别选择存储在注册表键下，编号为 n，n 为 0 到 9999 的任意整数；`cleanmgr /sagerun:n` 然后对所有枚举的驱动器运行该保存的配置文件，不显示对话框，且 /d 不与 /sagerun:n 一起使用。<sup>[1](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr)</sup> 必须先通过 `cleanmgr.exe /sageset:1` 手动定义预设，然后 `/sagerun:1` 才能重复它。<sup>[19](https://www.geeksforgeeks.org/techtips/automate-disk-cleanup-using-task-scheduler-in-windows/)</sup> /autoclean 开关自动删除 Windows 升级后留下的文件，该工具可通过任务计划程序工具进行计划。<sup>[1](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr)</sup>

## References

1. [cleanmgr | Microsoft Learn](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr)
2. [How to use Disk Cleanup in Windows 11 | TechTarget](https://www.techtarget.com/enterprise-software/tip/How-to-use-Disk-Cleanup-in-Windows-11)
3. [Windows 11 24H2 Storage Changes: Modern Tools Replace Disk Cleanup - Windows News](https://windowsnews.ai/article/windows-11-24h2-storage-changes-modern-tools-replace-disk-cleanup.343726)
4. [Free up drive space in Windows - Microsoft Support](https://support.microsoft.com/en-us/windows/free-up-drive-space-in-windows-85529ccb-c365-490d-b548-831022bc9b32)
5. [Windows Disk Cleanup: How to Free Up Drive Space - The High Tech Society](https://thehightechsociety.com/windows-disk-cleanup/)
6. [Disk Cleanup vs DISM: Two Different Layers, Real Numbers From Testing - Kleaner](https://kleaner.pro/en/blog/disk-cleanup-vs-dism)
7. [Manage drive space with Storage Sense | Microsoft Support](https://support.microsoft.com/en-us/windows/experience/storage-filemanagement/manage-drive-space-with-storage-sense)
8. [Cleanmgr - Delete Junk and Temp files command - SS64](https://ss64.com/nt/cleanmgr.html)
9. [Why does the Disk Cleanup tool's Windows Update Cleanup take so long and consume so much CPU? - The Old New Thing, Microsoft DevBlogs](https://devblogs.microsoft.com/oldnewthing/20200922-00/?p=104252)
10. [Understanding Component-Based Servicing | Microsoft Community Hub](https://techcommunity.microsoft.com/blog/askperf/understanding-component-based-servicing/373012)
11. [Clean Up the WinSxS Folder | Microsoft Learn](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/clean-up-the-winsxs-folder?view=windows-11)
12. [How to Run Disk Cleanup on Windows 10 & 11 | IT Cares](https://itcares.ca/en/blog/disk-cleanup-windows-10.html)
13. [Why Disk Cleanup Misses GBs of Recoverable Space on Windows 11 - WiseChecker](https://wisechecker.com/disk-cleanup-misses-gbs-recoverable-space-windows/)
14. [I ran one Disk Cleanup command and recovered 20GB of Windows Update files - MakeUseOf](https://www.makeuseof.com/disk-cleanup-command-recover-windows-update-files/)
15. [Disk Cleanup: What It Removes & How to Use It - PC Utility Hub](https://pcutilityhub.com/disk-tools/disk-cleanup/)
16. [Windows 11 24H2: Cleanup is no longer deleting all temporary files - gHacks Tech News](https://www.ghacks.net/2024/10/10/windows-11-24h2-cleanup-is-no-longer-deleting-all-temporary-files/)
17. [Windows 11 24H2: "update cleanup" space of 8.63 GB just an artifact | Eleven Forum](https://www.elevenforum.com/t/windows-11-24h2-update-cleanup-space-of-8-63-gb-just-an-artifact.29545/)
18. [Windows 11 Storage Bug Fixed: How KB5044384 Restores Trust in Disk Cleanup - Windows News](https://windowsnews.ai/article/windows-11-storage-bug-fixed-how-kb5044384-restores-trust-in-disk-cleanup.356886)
19. [How to Automate Disk Cleanup Using Task Scheduler in Windows? - GeeksforGeeks](https://www.geeksforgeeks.org/techtips/automate-disk-cleanup-using-task-scheduler-in-windows/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Operating systems › Microsoft Windows

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/disk-cleanup

English original: https://www.edgepedia.org/disk-cleanup
