← 返回综合新闻
Engadget 综合新闻 2026-11-24 09:30

您应该了解的用于修复 Windows 系统映像的三个 DISM 命令

The three DISM commands you should know to fix your Windows system images

使用这些 DISM 命令检查并修复损坏的系统文件。

您的 Windows 安装依赖于一组重要的系统文件来运行应用程序、安装更新和执行日常计算任务。如果这些文件损坏或丢失,您的系统可能会出现异常行为。您可能会遇到系统错误、功能无法按预期工作、冻结或其他意外行为。有时重新启动计算机或运行常规故障排除步骤不足以恢复损坏的系统文件。对于此类情况,Windows 提供了一个名为部署映像服务和管理 (DISM) 的内置修复实用程序。

DISM 是一个命令行工具,可以扫描 Windows 系统映像以查找损坏的系统文件并尝试修复。特别是,有三个有用的 DISM 命令可以实现此目的:CheckHealth、ScanHealth 和 RestoreHealth。您可以在命令提示符或 PowerShell 中运行 DISM 命令,但这两种 CLI 都需要管理员权限才能进行系统级更改。值得注意的是,DISM 专门扫描和修复系统文件;您的个人文件保持不变。

所有三个 DISM 命令都遵循以 DISM /Online /Cleanup-Image 开头的特定语法。语法中“DISM”后面的部分称为命令行选项。 /Online CLI 选项指定 DISM 对当前运行的 Windows 安装执行操作,而 /Cleanup-Image 对所选安装执行恢复操作。

第一个命令是 DISM /Online /Cleanup-Image /CheckHealth。它检查 Windows 是否已标记损坏的系统文件以及损坏是否可修复。这是调查损坏的系统文件时建议的第一个步骤,因为它只需很少的时间即可完成。

下一个命令是 DISM /Online /Cleanup-Image /ScanHealth,其工作方式与 CheckHealth 命令略有不同。与 CheckHealth 不同,ScanHealth DISM 命令会对系统文件执行全新扫描并报告其所有结果。 ScanHealth 操作可能需要几分钟才能完成,但它会为您提供有关组件存储运行状况的最新报告。

最后,DISM /Online /Cleanup-Image /RestoreHealth 命令会扫描组件存储是否损坏并尝试自动修复它们。默认情况下,RestoreHealth 使用 Windows Update 来获取修复组件存储所需的必要系统文件。 Windows 组件存储是一个受保护的内部存储库,其中包含重要的系统文件。 Windows 需要这些文件来服务、更新和自定义操作系统。

有时系统文件损坏也会破坏 Windows 更新,从而阻止 DISM 下载替换文件。发生这种情况时,您可以使用官方 Windows 安装介质向 DISM 提供必要的修复文件。您可以从 Microsoft 的官方下载页面下载 Windows ISO。下载后,右键单击 ISO 文件并选择挂载。 Windows 将为 ISO 创建一个虚拟驱动器,为其分配一个驱动器号并使其内容可用。

接下来,您需要检查下载的安装介质中提供的 Windows 版本。您可以通过以管理员身份启动命令提示符并运行 DISM /Get-ImageInfo /ImageFile:D:sourcesinstall.wim 命令来执行此操作。此命令列出安装介质上可用的 Windows 版本及其索引号。在继续下一步之前,记下与您安装的版本相对应的索引号。

现在,运行 DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:sourcesinstall.wim:6 /LimitAccess 命令。将 D: 替换为分配给已安装的 Windows ISO 的驱动器号,将 6 替换为与您的 Windows 版本对应的索引号。这会指示 DISM 使用安装介质作为其修复源,而不是从 Windows 更新下载文件。

DISM 完成操作后,运行 sfc /scannow 命令修复损坏或丢失的系统文件。 Microsoft 建议在系统文件检查器 (SFC) 之前运行 DISM 修复实用程序,因为 DISM 会修复 Windows 组件存储,而 SFC 依赖该组件存储来替换损坏的系统文件。

原文(English)

Check and repair damaged system files with these DISM commands.

Your Windows installation depends on a collection of important system files to run applications, install updates and perform everyday computing tasks. If these files get damaged or go missing, your system may behave erratically. You may encounter system errors, features not working as expected, freezes or other unexpected behavior. Sometimes restarting your computer or running the usual troubleshooting steps aren't enough to restore damaged system files. For such cases, Windows provides a built-in repair utility called Deployment Image Servicing and Management (DISM).

DISM is a command line tool that can scan Windows system images for corrupt system files and attempt repairs. Particularly, there are three useful DISM commands that achieve this purpose: CheckHealth, ScanHealth and RestoreHealth. You can run DISM commands in either the command prompt or the PowerShell, but both CLIs require administrator privileges to make system-level changes. It's worth noting that DISM exclusively scans and repairs system files; your personal files remain untouched.

All three DISM commands in question follow a specific syntax that begins with DISM /Online /Cleanup-Image. The parts following "DISM" in the syntax are called command-line options. The /Online CLI option specifies DISM to take action on the currently running Windows installation, while /Cleanup-Image performs recovery operations on the selected installation.

The first command is DISM /Online /Cleanup-Image /CheckHealth. It checks whether Windows has already flagged corrupt system files and whether the corruption is repairable. This is the first recommended step when investigating corrupt system files as it takes very little time to complete.

The next command is DISM /Online /Cleanup-Image /ScanHealth and it works slightly differently from the CheckHealth command. Unlike CheckHealth, the ScanHealth DISM command performs a fresh scan of your system files and reports any its findings. The ScanHealth operation may take several minutes to complete, but it provides you with a fresh report on the component store's health.

Finally, the DISM /Online /Cleanup-Image /RestoreHealth command both scans the component store for corruption and attempts to repair them automatically. By default, RestoreHealth uses Windows Update to obtain the necessary system files needed to repair the component store. The Windows component store is a protected internal repository that contains important system files. Windows requires these files to service, update and customize the operating system.

Sometimes system file damage can also break Windows Update, preventing DISM from downloading replacement files. When this happens, you can use an official Windows installation media to supply DISM with the necessary repair files. You can download a Windows ISO from Microsoft's official download page. Once downloaded, right click the ISO file and select mount. Windows will create a virtual drive for the ISO, assign it a drive letter and make its contents available.

Next, you'll need to check the Windows editions available in the downloaded installation media. You can do that by launching the command prompt as an administrator and running the DISM /Get-ImageInfo /ImageFile:D:sourcesinstall.wim command. This command lists the Windows editions available on the installation media along with their index numbers. Make a note of the index number corresponding to your installed edition before proceeding to the next step.

Now, run the DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:sourcesinstall.wim:6 /LimitAccess command. Replace D: with the drive letter assigned to the mounted Windows ISO and 6 with the index number corresponding to your Windows edition. This directs DISM to use the installation media as its repair source instead of downloading files from Windows Update.

Once DISM completes its operation, run the sfc /scannow command to repair damaged or missing system files. Microsoft recommends running the DISM repair utility before System File Checker (SFC) because DISM repairs the Windows component store, which SFC relies on to replace corrupted system files.

本文为自动翻译,可能存在偏差,请以原文为准。发布于 2026-11-24 09:30

阅读原文 ↗https://www.engadget.com/2320620/dism-commands-for-windows-s