修复 Windows 映像Repair a Windows Image

使用 DISM 修复 Windows 映像。Repair a Windows image using DISM. 可以修复 WIM 或 VHD 文件中的脱机 Windows 映像或联机 Windows 映像。You can repair offline Windows image in a WIM or VHD file, or an online Windows image. 如果联机 Windows 映像变得无法使用,它也会尝试对其进行自我修复。An online Windows image will also attempt to repair itself if it becomes unserviceable. 此操作的修复源与用于按需功能的源相同,并由组策略设置确定。The repair source for this operation is the same source that is used for Features on Demand and is determined by Group Policy settings. 有关详细信息,请参阅配置 Windows 修复源For more information, see Configure a Windows Repair Source. 使用 DISM 工具修复联机或脱机映像时,可以将 /Source 参数与 /RestoreHealth 参数一起使用,以指定要用于搜索所需文件的其他修复源位置 。When you use the DISM tool to repair an online or offline image, you can use the /Source argument with the /RestoreHealth argument to specify additional repair source locations to use to search for the required files.

要快速检查联机映像,可以使用命令:sfc /scannow 扫描和修复文件。For a quick check of an online image, you may be able to use the command: sfc /scannow to scan and repair files.

要进行更全面的检查以解决存储问题,请使用 DISM /Cleanup-ImageFor a more extensive check that can repair issues with the store, use DISM /Cleanup-Image.

检查映像是否可修复To check if an image is repairable

  1. 扫描映像以检查是否有损坏。Scan the image to check for corruption. 此操作将需要几分钟时间。This operation will take several minutes. 例如,在命令提示符处键入以下命令:For example, at a command prompt, type the following command:

    Dism /Online /Cleanup-Image /ScanHealth
    
  2. 检查映像,查看是否检测到任何损坏。Check the image to see whether any corruption has been detected. 例如,在命令提示符处键入:For example, at a command prompt, type:

    Dism /Online /Cleanup-Image /CheckHealth
    

使用 /CheckHealth sfc 参数时,DISM 工具将报告映像是正常、可修复还是无法修复 。When you use the /CheckHealth sfc argument, the DISM tool will report whether the image is healthy, repairable, or non-repairable. 如果映像无法修复,应放弃映像并再次开始。If the image is non-repairable, you should discard the image and start again. 如果映像是可修复的,可以使用 /RestoreHealth 参数来修复映像 。If the image is repairable, you can use the /RestoreHealth argument to repair the image.

修复映像To repair an image

  • 使用 /RestoreHealth 参数来修复映像 。Use the /RestoreHealth argument to repair the image. 例如,要将装载的映像作为修复源来修复脱机映像,请在命令提示符处键入以下命令:For example, to repair an offline image using a mounted image as a repair source, at a command prompt, type the following command:

    Dism /Image:C:\offline /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows
    

    或者,要使用一些你自己的源而不是 Windows 更新来修复联机映像,请键入:Or to repair an online image using some of your own sources instead of Windows Update, type:

    Dism /Online /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows /LimitAccess
    

    如果没有为修复文件指定 /Source,将使用按需功能的默认位置 。If you do not specify a /Source for the repair files, the default location for Features on Demand is used. 有关详细信息,请参阅配置 Windows 修复源For more information, see Configure a Windows Repair Source. 如果指定了多个 /Source,则将从找到文件的第一个位置复制文件,并忽略其他位置 。If you specify more than one /Source, the files are copied from the first location where they are found and the rest of the locations are ignored. 可使用 /LimitAccess 来阻止 DISM 工具将 Windows 更新作为修复源或作为联机映像的备份修复源 。You can use /LimitAccess to prevent the DISM tool from using Windows Update as a repair source or as a backup repair source for online images.

维护期间修复映像Repairing images during servicing

在某些情况下,使用 DISM 进行修改时,映像可能会损坏。In some cases, an image can be corrupted while modifying it with DISM. 可使用 /Cleanup-MountPoints 进行修复 。Use /Cleanup-MountPoints to repair it. 此命令不会卸载已装载的映像,也不会删除可以使用 /Remount-Image 命令恢复的映像。This command will not unmount images that are already mounted, nor will it delete images that can be recovered using the /Remount-Image command.

Dism /Cleanup-Mountpoints

相关主题Related topics

使用系统文件检查器工具修复丢失或损坏的系统文件Use the System File Checker tool to repair missing or corrupted system files

DISM 操作系统包服务命令行选项DISM Operating System Package Servicing Command-Line Options

配置 Windows 修复源Configure a Windows Repair Source