DISM 映像管理命令行选项DISM Image Management Command-Line Options

部署映像服务和管理 (DISM.exe) 装载用于服务的 Windows 映像 (.wim) 文件或虚拟硬盘(.vhd 或 .vhdx)。Deployment Image Servicing and Management (DISM.exe) mounts a Windows image (.wim) file or virtual hard disk (.vhd or .vhdx) for servicing. 还可以使用 DISM 映像管理命令列出映像索引号,以验证要装载的映像的体系结构、追加映像、应用映像、捕获映像以及删除映像。You can also use the DISM image management command to list the image index numbers, to verify the architecture for the image that you are mounting, append an image, apply an image, capture an image and delete an image. 更新映像后,必须将其卸载,然后提交或丢弃所做的更改。After you update the image, you must unmount it and either commit or discard the changes that you have made.

本主题介绍与映像管理相关的 DISM 命令。This topic discusses DISM commands related to image management. 若要查看其他命令行选项,请参阅部署映像服务和管理 (DISM) 命令行选项To see other command-line options, see Deployment Image Servicing and Management (DISM) Command-Line Options. 有关常见 DISM 方案的详细信息,请参阅什么是 DISM?For more information about common DISM scenarios, see What is DISM?.

除命令行工具以外,还可以通过 Windows PowerShell 来使用 DISM。In addition to the command-line tool, DISM is available by using Windows PowerShell. 有关详细信息,请参阅 Windows PowerShell 中的 部署映像服务管理 (DISM) CmdletFor more information, see Deployment Imaging Servicing Management (DISM) Cmdlets in Windows PowerShell.

以下命令可用于装载、卸载、捕获、追加、删除和查询 .wim、.vhd 和 .vhdx 文件。The following commands can be used to mount, unmount, capture, append, and delete and query .wim, .vhd and .vhdx files. 这些选项不区分大小写。These options are not case sensitive.

/Append-Image/Append-Image

将附加映像添加到 .wim 文件。Adds an additional image to a .wim file. /Append-Image 将新文件与 /ImageFile 参数指定的现有 .wim 文件中的资源进行比较,它仅存储每个唯一文件的单个副本,以便仅捕获每个文件一次。/Append-Image compares new files to the resources in the existing .wim file specified by the /ImageFile argument, and stores only a single copy of each unique file so that each file is only captured once. 只能为 .wim 文件分配一种压缩类型。The .wim file can have only one assigned compression type. 因此,只能追加具有相同压缩类型的文件。Therefore, you can only append files with the same compression type.

此命令行选项不适用于虚拟硬盘 (VHD) 文件。This command-line option does not apply to virtual hard disk (VHD) files.

重要

确保有足够的磁盘空间可用于运行 /Append-Image 选项。Ensure that you have enough disk space for the /Append-Image option to run. 如果在追加映像时磁盘空间不足,可能会损坏 .wim 文件。If you run out of disk space while the image is being appended, you might corrupt the .wim file.

语法:Syntax:

DISM.exe /Append-Image /ImageFile:<path_to_image_file> /CaptureDir:<source_directory> /Name:<image_name> [/Description:<image_description>] [/ConfigFile:<configuration_file.ini>] [/Bootable] /WIMBoot [/CheckIntegrity] [/Verify] [/NoRpFix]
参数Parameter 说明Description
/WIMBoot/WIMBoot 使用 /WIMBoot 可以追加采用 Windows 映像文件启动 (WIMBoot) 配置的映像。Use /WIMBoot to append the image with Windows image file boot (WIMBoot) configuration. 此参数仅适用于已作为 WIMBoot 文件捕获或导出的 Windows 8.1 映像。This only applies to Windows 8.1 images that have been captured or exported as a WIMBoot file. Windows 10 不支持此功能。This feature isn't supported in Windows 10.
/ConfigFile/ConfigFile 指定用于列出映像捕获和压缩命令排除项的配置文件的位置。specifies the location of a configuration file that lists exclusions for image capture and compress commands. 有关详细信息,请参阅 DISM 配置列表和 WimScript.ini 文件For more information, see DISM Configuration List and WimScript.ini Files.
/Bootable/Bootable 将卷映像标记为可启动映像。Marks a volume image as being a bootable image. 此参数仅适用于 Windows 预安装环境 (WinPE) 映像。This argument is available only for Windows Preinstallation Environment (WinPE) images. 在 .wim 文件中,只能将一个卷映像标记为可启动。Only one volume image can be marked as bootable in a .wim file.
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Verify/Verify 检查有无错误和文件重复。Checks for errors and file duplication.
/NoRpFix/NoRpFix 禁用重新分析点标记修复。Disables the reparse point tag fix. 重新分析点是一个文件,它包含指向文件系统中其他文件的链接。A reparse point is a file that contains a link to another file on the file system. 如果未指定 /NoRpFix,将不捕获解析为 /ImageFile 所指定值范围外的路径的重分析点。If /NoRpFix is not specified, reparse points that resolve to paths outside of the value specified by /ImageFile will not be captured.

例如:Example:

Dism /Append-Image /ImageFile:install.wim /CaptureDir:D:\ /Name:Drive-D

/Apply-FFU/Apply-FFU

对于 FFU,此命令将对指定的物理驱动器应用完整闪存实用工具 (FFU) 或拆分 FFU (SFU)。For FFU, this command applies a Full Flash Utility (FFU) or split FFU (SFU) to a specified physical drive.

语法:Syntax:

/Apply-Ffu /ImageFile:<path_to_image_file> /ApplyDrive:<physical_drive_path> [/SFUFile:<pattern>]
参数Parameter 说明Description
/ImageFile/ImageFile 要应用的 FFU 映像文件的路径和名称The path and name of the FFU image file that will be applied
/ApplyDrive/ApplyDrive 将创建映像的物理驱动器的路径The path to the phyisical drive that will be imaged
/SFUfile<pattern>/SFUfile<pattern> 可选,适用于在不压缩的情况下捕获的拆分 FFU。Optional, for split FFUs that are captured with no compression. 使用 /SFUFile 可引用拆分 FFU 文件 (SFU)。Use /SFUFile to reference split FFU files (SFUs). Pattern 是拆分文件的命名模式和位置。Pattern is the naming pattern and location of split files. 指定命名模式时,请使用通配符。Use a wildcard character when specifying the naming pattern. 例如,“E:\image\install*.sfu”将应用 E:\image 目录中所有名为 install1.sfu、install2.sfu 等的拆分文件。For example, "E:\image\install*.sfu" will apply all of the split files in the E:\image directory named install1.sfu, install2.sfu, and so on.

例如:Example:

DISM.exe /Apply-Ffu /ImageFile:flash.ffu /ApplyDrive:\\.\PhysicalDrive0

/Apply-Image/Apply-Image

对于 WIM,此命令将对指定的分区应用 Windows 映像文件 (.wim) 或拆分的 Windows 映像 (.swm) 文件。For WIM, this command applies a Windows image file (.wim) or a split Windows image (.swm) files to a specified partition. 从 Windows 10 版本 1607 开始,DISM 可以应用和捕获扩展属性 (EA)。Beginning with Windows 10, version 1607, DISM can apply and capture extended attributes (EA).

对于 FFU,此命令将对指定的驱动器应用完整闪存更新 (.ffu) 映像。For FFU, this command applies a full flash update (.ffu) image to a specified drive. 它不支持从虚拟硬盘 (.vhdx) 文件应用映像,但你可以使用此命令对 VHD 应用完整映像。It doesn’t support applying an image from a virtual hard disk (.vhdx) file, though you can use this command to apply a full image to a VHD. FFU 仅适用于 Windows 10。FFU applies to Windows 10 only. 虽然可以使用此命令来应用 FFU,但请改用 /apply-ffuWhile you can use this command to apply an FFU, use /apply-ffu instead.

此选项不支持从虚拟硬盘 (VHD) 应用映像,但你可以使用此命令对 .vhdx 文件应用已附加、已分区且已格式化的映像。This option doesn’t support applying an image from a virtual hard disk (VHD), though you can use this command to apply images to a .vhdx file that's been attached, partitioned, and formatted.

WIM 的参数:Arguments for WIM:

DISM.exe /Apply-Image /ImageFile:<path_to_image_file> [/SWMFile:<pattern>] /ApplyDir:<target_directory> {/Index:< image_index> | /Name:<image_name>} [/CheckIntegrity] [/Verify] [/NoRpFix] [/ConfirmTrustedFile] [/WIMBoot (deprecated)] [/Compact] [/EA]

FFU 的参数Arguments for FFU

请参阅 /apply-ffuSee /apply-ffu.

参数Parameter 说明Description
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Verify/Verify 检查有无错误和文件重复。Checks for errors and file duplication.
/NoRpFix/NoRpFix 禁用重新分析点标记修复。Disables the reparse point tag fix. 重新分析点是一个文件,它包含指向文件系统中其他文件的链接。A reparse point is a file that contains a link to another file on the file system. 如果未指定 /NoRpFix,将不捕获解析为 /ImageFile 所指定值范围外的路径的重分析点。If /NoRpFix is not specified, reparse points that resolve to paths outside the value specified by /ImageFile will not be captured.
/SWMFile/SWMFile 用于引用拆分的 .wim 文件 (SWM)。Enables you to reference split .wim files (SWMs). Pattern 是拆分文件的命名模式和位置。Pattern is the naming pattern and location of split files. 指定命名模式时,请使用通配符。Use a wildcard character when specifying the naming pattern. 例如,“E:\image\install*.swm”将应用 E:\image 目录中所有名为 install1.swm、install2.swm 等的拆分文件。For example, "E:\image\install*.swm" will apply all of the split files in the E:\image directory named install1.swm, install2.swm, and so on.
/ConfirmTrustedFile/ConfirmTrustedFile 验证 Windows 10、Windows 8.1 或 Windows 8 上受信任桌面的映像。Validates the image for Trusted Desktop on a Windows 10, Windows 8.1, or Windows 8. 此选项只能在至少运行 WinPE 4.0 的计算机上运行。This option can only be run on a computer running at least WinPE 4.0. 将 /Apply-Image 与 WinPE 中的 /ConfirmTrustedFile 选项结合使用时,请始终指定指向物理媒体位置的 /ScratchDir 选项。When using /Apply-Image with the /ConfirmTrustedFile option in WinPE, always specify the /ScratchDir option pointed to a physical media location. 这可以确保短文件名始终可用。This ensures that short file names will always be available. 有关 /ScratchDir 选项的默认行为的详细信息,请参阅 DISM 命令行语法的全局选项See DISM Global Options for Command-Line Syntax for more information about the default behavior of the /ScratchDir option. 从 Windows 10 版本 1607 开始,可以使用 /EA 来应用扩展属性。Beginning with Windows 10, version 1607, you can use /EA to apply extended attributes.
/WIMBoot/WIMBoot 使用 /WIMBoot 可以追加采用 Windows 映像文件启动 (WIMBoot) 配置的映像。Use /WIMBoot to append the image with Windows image file boot (WIMBoot) configuration. 此参数仅适用于已作为 WIMBoot 文件捕获或导出的 Windows 8.1 映像。This only applies to Windows 8.1 images that have been captured or exported as a WIMBoot file. Windows 10 不支持此功能。This feature isn't supported in Windows 10.
/Compact/Compact 在紧凑模式下应用映像,以节省驱动器空间。Applies an image in compact mode, saving drive space. 取代了 WIMBoot。Replaces WIMBoot. 仅适用于 Windows 10 桌面版(家庭版、专业版、企业版和教育版)。For Windows 10 for desktop editions (Home, Pro, Enterprise, and Education) only.

注意: 如果使用 /ScratchDir 选项在紧凑模式下应用映像,请确保 ScratchDir 文件夹不在 FAT32 格式的分区中。Note: If you're applying an image in compact mode with the /ScratchDir option, make sure your ScratchDir folder is not on a FAT32-formatted partition. 使用 FAT32 分区可能会导致 OOBE 期间发生意外的重新启动。Using a FAT32 partition could result in unexpected reboots during OOBE.
/EA/EA Windows 10 版本 1607 中的新增功能。New in Windows 10, version 1607. 应用扩展属性。Applies extended attributes.
/ApplyDrive/ApplyDrive 使用 DeviceID 指定逻辑驱动器。Specifies the logical drive, using the DeviceID. 若要从命令行获取设备 ID,请键入“wmic diskdrive list brief”。to get the device ID from the command line, type "wmic diskdrive list brief". 注意:VHD 在说明中可能会以名称“PhysicalDrive”显示,例如 .\PhysicalDrive2。Note: a VHD may appear with the name “PhysicalDrive” in the description, for example, .\PhysicalDrive2.
/SFUFile/SFUFile 使用 /SFUFile 可引用拆分 FFU 文件 (SFU)。Use /SFUFile to reference split FFU files (SFUs). Pattern 是拆分文件的命名模式和位置。Pattern is the naming pattern and location of split files.

示例:Examples:

Dism /apply-image /imagefile:install.wim /index:1 /ApplyDir:D:\
Dism /apply-image /imagefile:install.swm /swmfile:install.swm /index:1 /applydir:D:

/Capture-CustomImage/Capture-CustomImage

将基于特定 install.wim 文件的增量文件更改捕获到 WIMBoot 映像的新文件 custom.wim 中。Captures the incremental file changes based on the specific install.wim file to a new file, custom.wim for a WIMBoot image. 不能捕获空目录。You can’t capture an empty directory. 捕获的文件将转换为指针文件。The captured files are converted to pointer files. custom.wim 放在 install.wim 旁边的同一个文件夹中。The custom.wim is placed in the same folder next to the install.wim.

重要须知Important

  • /Capture-CustomImage 仅捕获自定义项文件。/Capture-CustomImage only captures the customization files. 不能使用它将安装文件捕获到新的 WIM 中。It can’t be used to capture installation files into a new WIM.
  • 请将 install.wim 和 custom.wim 文件放在一起。Keep the install.wim and custom.wim files together. 请不要移出 install.wim 文件或 custom.wim 文件。Don't switch out either the custom.wim file or the install.wim file.
  • 只能捕获自定义映像一次。You can only capture the custom image once. 捕获增量文件更改后,请不要删除或重新捕获 custom.wim。Don’t remove or recapture a custom.wim after capturing the incremental file changes.

语法:Syntax:

Dism /Capture-CustomImage /CaptureDir:<source_directory> [/ConfigFile:<configuration_file.ini>] [/CheckIntegrity] [/Verify] [/ConfirmTrustedFile]
参数Parameter 说明Description
/CaptureDir/CaptureDir 指定要在其中应用和自定义映像的目录。Specifies the directory to which the image was applied and customized.
/ConfigFile/ConfigFile 指定用于列出映像捕获和压缩命令排除项的配置文件的位置。Specifies the location of a configuration file that lists exclusions for image capture and compress commands. 有关详细信息,请参阅 DISM 配置列表和 WimScript.ini 文件For more information, see DISM Configuration List and WimScript.ini Files.
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Verify/Verify 检查有无错误和文件重复。Checks for errors and file duplication.
[/ConfirmTrustedFile[/ConfirmTrustedFile 验证 Windows 10、Windows 8.1 或 Windows 8 上受信任桌面的映像。Validates the image for Trusted Desktop on a Windows 10, Windows 8.1, or Windows 8. 此选项只能在至少运行 WinPE 4.0 的计算机上运行。This option can only be run on a computer running at least WinPE 4.0.

例如:Example:

Dism /Capture-CustomImage /CaptureDir:D:\

/Capture-FFU/Capture-FFU

将物理驱动器分区的映像捕获到新的 .ffu 文件。Captures an image of a physical drive's partitions to a new .ffu file.

可将映像作为完整闪存实用工具映像 (.ffu) 文件或一组 FFU (.sfu) 拆分文件进行捕获;You can capture the image as a full flash utility image (.ffu) file or a set of split ffu (.sfu) files;

语法:Syntax:

Dism /Capture-Ffu /ImageFile:<path_to_image_file> /CaptureDrive:<physical_drive_path> /Name:<image_name> [/Description:<image_description>] [/PlatformIds:<platform_ids>] [/Compress:{default|none}] 
参数Parameter 说明Description
/CaptureDrive/CaptureDrive 要捕获的物理驱动器。The physical drive to be captured. 可以使用 diskpart 获取驱动器号信息You can use diskpart to get drive number information. 请使用 \\.\PhysicalDriveX 格式,其中,X 是 diskpart 提供的磁盘号。Uses the format \\.\PhysicalDriveX, where X is the disk number that diskpart provides.
/PlatformIds/PlatformIds 桌面捕获不需要此参数。Not needed for desktop capture. 指定要添加到映像中的一个或多个平台 ID(以分号分隔)。Specifies one or more platform ids (separated with semicolon) to be added to the image. 如果未指定,则平台 ID 将是“*”。If not specified, platform id will be '*'.
/Compress/Compress 指定捕获时使用的压缩类型。Specifies the type of compression used for when capturing. 如果要拆分 FFU,请指定 none,因为 DISM 不支持拆分压缩的 FFU。If you'll be splitting the FFU, specify none, as DISM doesn't support splitting compressed FFUs.

示例:Examples:

捕获桌面 FFU:Capture a desktop FFU:

DISM.exe /Capture-Ffu /ImageFile:install.ffu /CaptureDrive:\\.\PhysicalDrive0 /Name:Drive0

捕获要拆分的桌面 FFU:Capture a desktop FFU that will be split:

DISM.exe /Capture-Ffu /ImageFile:install.ffu /CaptureDrive:\\.\PhysicalDrive0 /Name:Drive0 /Compress:none

/Capture-Image/Capture-Image

将驱动器的映像捕获到新的 .wim 文件。Captures an image of a drive to a new .wim file. 捕获的目录包括所有子文件夹和数据。Captured directories include all subfolders and data. 不能捕获空目录。You cannot capture an empty directory. 目录必须至少包含一个文件。A directory must contain at least one file. DISM 还可以选择性地应用和捕获扩展属性 (EA)。DISM can also optionally apply and capture extended attributes (EA).

可将映像作为 Windows 映像 (.wim) 文件或一组拆分的 Windows 映像 (.swm) 文件进行捕获;但此选项不支持捕获虚拟硬盘 (.vhd/.vhdx) 文件。You can capture the image as a Windows image (.wim) file or a set of split Windows image (.swm) files, but this option doesn’t support capturing a virtual hard disk (.vhd/.vhdx) file. 如果希望捕获 FFU,请参阅 /Capture-FFUSee /Capture-FFU if you are looking to capture an FFU.

语法:Syntax:

Dism /Capture-Image /ImageFile:<path_to_image_file> /CaptureDir:<source_directory> /Name:<image_name> [/Description:<image_description>]
[/ConfigFile:<configuration_file.ini>] {[/Compress:{max|fast|none}] [/Bootable] | [/WIMBoot]} [/CheckIntegrity] [/Verify] [/NoRpFix] [/EA]
参数Parameter 说明Description
/ConfigFile/ConfigFile 指定用于列出映像捕获和压缩命令排除项的配置文件的位置。Specifies the location of a configuration file that lists exclusions for image capture and compress commands. 有关详细信息,请参阅 DISM 配置列表和 WimScript.ini 文件For more information, see DISM Configuration List and WimScript.ini Files.
/Compress/Compress 指定用于初始捕获操作的压缩类型。Specifies the type of compression used for the initial capture operation. maximum 选项提供最佳压缩效果,但需要更多的时间来捕获映像。The maximum option provides the best compression, but takes more time to capture the image. fast 选项提供更快的映像压缩,但生成的文件比使用 maximum 选项压缩的文件要大。The fast option provides faster image compression, but the resulting files are larger than those compressed by using the maximum option. 这也是在未指定参数时所用的默认压缩类型。This is also the default compression type that is used if you do not specify the argument. none 选项根本不压缩捕获的映像。The none option does not compress the captured image at all.
/Bootable/Bootable 将卷映像标记为可启动映像。Marks a volume image as being a bootable image. 此参数仅适用于 WinPE 映像。This argument is available only for WinPE images. 在 .wim 文件中,只能将一个卷映像标记为可启动。Only one volume image can be marked as bootable in a .wim file.
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Verify/Verify 检查有无错误和文件重复。Checks for errors and file duplication.
/NoRpFix/NoRpFix 禁用重新分析点标记修复。Disables the reparse point tag fix. 重新分析点是一个文件,它包含指向文件系统中其他文件的链接。A reparse point is a file that contains a link to another file on the file system. 如果未指定 /NoRpFix,将不捕获解析为 /ImageFile 所指定值范围外的路径的重分析点。If /NoRpFix is not specified, reparse points that resolve to paths outside of the value specified by /ImageFile will not be captured.
/WIMBoot/WIMBoot 使用 /WIMBoot 可以追加采用 Windows 映像文件启动 (WIMBoot) 配置的映像。Use /WIMBoot to append the image with Windows image file boot (WIMBoot) configuration. 此参数仅适用于已作为 WIMBoot 文件捕获或导出的 Windows 8.1 映像。This only applies to Windows 8.1 images that have been captured or exported as a WIMBoot file. Windows 10 不支持此功能。This feature isn't supported in Windows 10.
/EA/EA 捕获扩展属性。Captures extended attributes. 必须显式指定该开关才能捕获扩展特性。The switch must be explicitly specified to capture extended attributes. 如果已在组件中将扩展属性位设置为捕获到 WIM 映像中,则 DISM 会捕获这些位。DISM will capture extended attribute bits if they are set in the components to be captured in the WIM image. 如果未设置这些位,则 DISM 不会设置它们。If the bits are not set, DISM won't set them. 只有 CAB 包和驱动程序的内置组件包含这些扩展属性位,AppX 包组件或 Win32 应用程序组件不包含这些位。Only the inbox components of CAB packages and drivers will have these extended attribute bits, not the AppX package components or Win32 application components. 将跳过名称中带有前缀“$Kernel.”的扩展属性,Extended attributes with prefix “$Kernel.” 因为只捕获用户模式扩展属性。in name will be skipped because only user mode extended attributes are captured. 如果在 Windows 10 版本 1607 中使用 DISM 来捕获扩展属性,并使用早期版本的 DISM 来应用映像,则操作将会成功,但扩展属性不会设置到应用的映像。If you use DISM in Windows 10, version 1607 to capture extended attributes and use an earlier version of DISM to apply the image, the operation will succeed but the extended attributes will not be set to the applied image.

示例:Examples:

Dism /Capture-Image /ImageFile:install.wim /CaptureDir:D:\ /Name:Drive-D
dism /Capture-Image /CaptureDir:C:\ /ImageFile:"C:\WindowsWithOffice.wim" /Name:"Chinese Traditional" /ea

/Cleanup-Mountpoints/Cleanup-Mountpoints

删除与损坏的已装载映像关联的所有资源。Deletes all of the resources associated with a mounted image that has been corrupted. 此命令不会卸载已装载的映像,也不会删除可以使用 /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.

例如:Example:

Dism /Cleanup-Mountpoints

有关详细信息,请参阅修复 Windows 映像To learn more, see Repair a Windows Image

/Commit-Image/Commit-Image

应用对已装载的映像所做的更改。Applies the changes that you have made to the mounted image. 在使用 /Unmount-Image 选项之前,该映像将保持已装载状态。The image remains mounted until the /Unmount-Image option is used.

语法:Syntax:

Dism /Commit-Image /MountDir:<path_to_mount_directory> [/CheckIntegrity] [/Append]
参数Parameter 说明Description
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Append/Append 将修改的映像添加到现有的 .wim 文件,而不是覆盖原始映像。Adds the modified image to the existing .wim file instead of overwriting the original image. /CheckIntegrity 和 /Append 参数不适用于虚拟硬盘 (VHD) 文件。The /CheckIntegrity and /Append arguments do not apply to virtual hard disk (VHD) files.

例如:Example:

Dism /Commit-Image /MountDir:C:\test\offline

/Delete-Image/Delete-Image

从包含多个卷映像的 .wim 文件中删除指定的卷映像。Deletes the specified volume image from a .wim file that has multiple volume images. 此选项仅删除元数据条目和 XML 条目。This option deletes only the metadata entries and XML entries. 它不会删除流数据,也不会优化 .wim 文件。It does not delete the stream data and does not optimize the .wim file.

此命令行选项不适用于虚拟硬盘 (VHD) 文件。This command-line option does not apply to virtual hard disk (VHD) files.

语法:Syntax:

Dism /Delete-Image /ImageFile:<path_to_image_file> {/Index:<image_index> | /Name:<image_name>} [/CheckIntegrity]
参数Parameter 说明Description
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.

例如:Example:

Dism /Delete-Image /ImageFile:install.wim /Index:1

/Export-Image/Export-Image

将指定映像的副本导出到另一个文件。Exports a copy of the specified image to another file. 源文件和目标文件必须使用相同的压缩类型。The source and destination files must use the same compression type. 也可以通过将映像导出到新的映像文件,来优化该映像。You can also optimize an image by exporting to a new image file. 如果修改映像,DISM 将存储额外的资源文件,这会增大映像的总体大小。When you modify an image, DISM stores additional resource files that increase the overall size of the image. 导出映像会删除不必要的资源文件。Exporting the image will remove unnecessary resource files.

此命令行选项不适用于虚拟硬盘 (VHD) 文件。This command-line option does not apply to virtual hard disk (VHD) files.

语法:Syntax:

Dism /Export-Image /SourceImageFile:<path_to_image_file> {/SourceIndex:<image_index> | /SourceName:<image_name>} /DestinationImageFile:<path_to_image_file> [/DestinationName:<Name>] [/Compress:{fast|max|none|recovery}] [/Bootable] [/WIMBoot] [/CheckIntegrity]
参数Parameter 说明Description
/SWMFile/SWMFile 用于引用拆分的 .wim 文件。Enables you to reference split .wim files. pattern 是拆分文件的命名模式和位置。pattern is the naming pattern and location of split files. 还可以指定通配符。You can also specify wildcard characters. 例如,“E:\image\install*.swm”将导出 E:\image 目录中所有名为 install1.swm、install2.swm 等的拆分文件。For example, "E:\image\install*.swm" will export the split files in the E:\image directory named install1.swm, install2.swm, and so on.
/Compress/Compress 指定用于初始捕获操作的压缩类型。Specifies the type of compression used for the initial capture operation. 将映像导出到现有 .wim 文件时,/Compress 参数不适用;只有在将映像导出到新的 .wim 文件时,才能使用此参数。The /Compress argument does not apply when you export an image to an existing .wim file, you can only use this argument when you export an image to a new .wim file. maximum 选项提供最佳压缩效果,但需要更多的时间来捕获映像。The maximum option provides the best compression, but takes more time to capture the image. fast 选项提供更快的映像压缩,但生成的文件比使用 maximum 选项压缩的文件要大。The fast option provides faster image compression, but the resulting files are larger than those compressed by using the maximum option. 这也是在未指定参数时所用的默认压缩类型。This is also the default compression type that is used if you do not specify the argument. 使用 recovery 选项可导出一键重置映像。Use the recovery option to export push-button reset images. 生成的文件要小得多,因而可以大大减少在恢复驱动器上保存一键重置映像所需的磁盘空间量。The resulting files are much smaller in size, which in turn, greatly reduce the amount of disk space needed for saving the push-button reset image on a recovery drive. 必须使用 .esd 扩展名指定目标文件。The destination file must be specified with an .esd extension. none 选项根本不压缩捕获的映像。The none option does not compress the captured image at all.
/Bootable/Bootable 将卷映像标记为可启动映像。Marks a volume image as being a bootable image. 此参数仅适用于 WinPE 映像。This argument is available only for WinPE images. 在 .wim 文件中,只能将一个卷映像标记为可启动。Only one volume image can be marked as bootable in a .wim file.
/WIMBoot/WIMBoot 使用 /WIMBoot 可以追加采用 Windows 映像文件启动 (WIMBoot) 配置的映像。Use /WIMBoot to append the image with Windows image file boot (WIMBoot) configuration. 此参数仅适用于已作为 WIMBoot 文件捕获或导出的 Windows 8.1 映像。This only applies to Windows 8.1 images that have been captured or exported as a WIMBoot file. Windows 10 不支持此功能。This feature isn't supported in Windows 10.
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.

例如:Example:

Dism /Export-Image /SourceImageFile:install.wim /SourceIndex:1 /DestinationImageFile:install2.wim

/Get-ImageInfo/Get-ImageInfo

显示有关 .wim、.ffu、.vhd 或 .vhdx 文件中包含的映像的信息。Displays information about the images that are contained in a .wim, .ffu, .vhd or .vhdx file. 与 /Index 或 /Name 参数结合使用时,将显示有关指定映像的信息,其中包括,该映像是否为 WIMBoot 映像、该映像是否为 Windows 8.1,具体请参阅使用 DISM 盘点映像或组件When used with the /Index or /Name argument, information about the specified image is displayed, which includes if an image is a WIMBoot image, if the image is Windows 8.1, see Take Inventory of an Image or Component Using DISM. /Name 参数不适用于 VHD 文件。The /Name argument does not apply to VHD files. 必须对 FFU 和 VHDX 文件指定 /Index:1。You must specify /Index:1 for FFU and VHDX files.

语法:Syntax:

Dism /Get-ImageInfo /ImageFile:<path_to_image.wim> [{/Index:<Image_index> | /Name:<Image_name>}]

示例:Examples:

Dism /Get-ImageInfo /ImageFile:C:\test\offline\install.wim
Dism /Get-ImageInfo /ImageFile:C:\test\images\myimage.vhd /Index:1

/Get-MountedImageInfo/Get-MountedImageInfo

返回当前装载的 .ffu、.vhd、.vhdx 和 .wim 映像列表,以及有关已装载的映像的信息,例如,该映像是否有效、读/写权限、装载位置、已装载文件的路径,以及已装载映像的索引。Returns a list of .ffu, .vhd, .vhdx, and .wim images that are currently mounted, as well as information about the mounted image such as whether the image is valid, read/write permissions, mount location, mounted file path, and mounted image index.

例如:Example:

Dism /Get-MountedImageInfo

/Get-WIMBootEntry/Get-WIMBootEntry

使用 /Get-WIMBootEntry 可以显示指定磁盘卷的 WIMBoot 配置条目。Use /Get-WIMBootEntry to display WIMBoot configuration entries for the specified disk volume.

有关如何显示 WIMBoot 配置条目的详细信息,请参阅“使用 DISM 盘点映像或组件”。For more information about how to display WIMBoot configuration entries, see Take Inventory of an Image or Component Using DISM.

此参数仅适用于 Windows 8.1;Windows 10 不支持此功能。This only applies to Windows 8.1; this feature isn't supported in Windows 10.

语法:Syntax:

Dism /Get-WIMBootEntry /Path:<volume_path>

例如:Example:

Dism /Get-WIMBootEntry /Path:C:\

/List-Image/List-Image

显示指定映像中的文件和文件夹列表。Displays a list of the files and folders in a specified image.

此命令行选项不适用于虚拟硬盘 (VHD) 文件。This command-line option does not apply to virtual hard disk (VHD) files.

语法:Syntax:

Dism /List-Image /ImageFile:<path_to_image_file> {/Index:<image_index> | /Name:<image_name>}

例如:Example:

Dism /List-Image /ImageFile:install.wim /Index:1

/Mount-Image/Mount-Image

将 .ffu、.wim、.vhd 或 .vhdx 文件中的映像装载到指定的目录,使其可用于服务。Mounts an image from a .ffu, .wim, .vhd or .vhdx file to the specified directory so that it is available for servicing.

装载映像时,请注意以下几点:When mounting an image, note the following:

  • 必须创建装载目录,但该目录必须是空的。The mount directory must be created, but empty.
  • 所有映像类型都需要索引或名称值。An index or name value is required for all image types. WIM 可以包含多个映像。WIMs can contain more than image. 对于 FFU 和 VHD,请使用 index:1For FFU and VHD, use index:1.

语法:Syntax:

Dism /Mount-Image /ImageFile:<path_to_image_file> {/Index:<image_index> | /Name:<image_name>} /MountDir:<path_to_mount_directory> [/ReadOnly] [/Optimize] [/CheckIntegrity]
参数Parameter 说明Description
/ReadOnly/ReadOnly 为装载的映像设置只读权限。Sets the mounted image with read-only permissions. 可选。Optional.
/Optimize/Optimize 缩短初始装载时间。Reduces initial mount time.
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.

示例:Examples:

Dism /Mount-Image /ImageFile:C:\test\images\myimage.wim /index:1 /MountDir:C:\test\offline
Dism /Mount-Image /ImageFile:C:\test\images\myimage.vhd /index:1 /MountDir:C:\test\offline /ReadOnly
Dism /Mount-Image /ImageFile:C:\test\images\WinOEM.ffu /MountDir:C:\test\offline /index:1

/Optimize-Image /WIMBoot/Optimize-Image /WIMBoot

对脱机映像执行指定的配置。Performs specified configurations to an offline image.

参数Parameter 说明Description
/WIMBoot/WIMBoot 配置脱机映像,以便在 Windows 映像文件启动 (WIMBoot) 系统上安装。configure an offline image for installing on a Windows image file boot (WIMBoot) system.
/Optimize/Optimize 缩短初始装载时间。Reduces initial mount time. /Optimize-Image /WIMBoot 仅适用于已作为 WIMBoot 文件捕获或导出的 Windows 8.1 映像。/Optimize-Image /WIMBoot only applies to Windows 8.1 images that have been captured or exported as a WIMBoot file. 请仅对支持 WIMBoot 的系统所用的映像使用 /Optimize-Image。Only use /Optimize-Image with images that will be used for WIMBoot supported systems. 如果将 /Optimize-Image 用于不支持 WIMBoot 的系统映像,则在不支持 WIMBoot 的设备上安装后,Windows 可能不会按预期方式运行。If /Optimize-Image is used with a non-WIMBoot supported system image, Windows may not work as expected, after installation on a non-WIMBoot supported device.

例如:Example:

Dism /Image:C:\test\offline /Optimize-Image /WIMBoot

/Remount-Image/Remount-Image

重新装载不可访问的已装载映像,并使其可用于服务。Remounts a mounted image that has become inaccessible and makes it available for servicing.

语法:Syntax:

Dism /Remount-Image /MountDir:<path_to_mount_directory>

例如:Example:

Dism /Remount-Image /MountDir:C:\test\offline

/Split-FFU/Split-FFU

对于 FFU,此命令会将现有的完整闪存更新 (.ffu) 文件拆分为多个只读的 .sfu 拆分文件。For FFU, this command splits an existing full-flash update (.ffu) file into multiple read-only split .sfu files. DISM 不支持拆分压缩的 FFU。DISM doesn't support splitting compressed FFUs. 如果要拆分 FFU,请确保 FFU 是在指定了 /compress:none 选项的情况下捕获的。If you are splitting FFUs, make sure that your FFU was captured with the /compress:none option specificed.

此选项将在指定的目录中创建 .sfu 文件,并根据相同的 /SFUFile 指定值将每个文件命名,但在名称中追加一个编号。This option creates the .sfu files in the specified directory, naming each file the same as the specified /SFUFile, but with an appended number. 例如,如果使用 c:\flash.sfu,则会获得类似于 flash.sfu、flash2.ffu、flash3.sfu 的文件。此选项会定义 .sfu 拆分文件的每个部分,并将其保存到 C:\ 目录。For example, if you use c:\flash.sfu, you'll get a flash.sfu file, a flash2.ffu file, a flash3.sfu file, and so on, defining each portion of the split .sfu file and saving it to the C:\ directory.

FFU 的语法:Syntax for FFU:

Dism /Split-Ffu /ImageFile:<path_to_image_file> /SFUFile:<pattern> /FileSize:<MB-Size> [/CheckIntegrity]
参数Parameter 说明Description
/FileSize/FileSize 指定每个已创建文件的最大大小 (MB)。Specifies the maximum size in megabytes (MB) for each created file. 如果单个文件大于 /FileSize 选项中指定的值,则生成的 .swm 拆分文件之一将大于 /FileSize 选项中指定的值,以容纳大文件。If a single file is larger than the value specified in the /FileSize option, one of the split .swm files that results will be larger than the value specified in the /FileSize option, in order to accommodate the large file.
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/ImageFile/ImageFile 指定某个 .FFU 文件(例如 flash.ffu)的路径。Specifies the path of a .FFU file, example: flash.ffu.
/SFUFile/SFUFile 引用拆分的 FFU 文件 (SFU)。References split FFU files (SFUs). Pattern 是拆分文件的命名模式和位置。Pattern is the naming pattern and location of split files.

例如:Example:

DISM.exe /Split-Ffu /ImageFile:flash.ffu /SFUFile:flash.sfu /FileSize:650

/Split-Image/Split-Image

对于 WIM,此命令会将现有的 .wim 文件拆分为多个只读的 .swm 拆分文件。For WIM, this command splits an existing .wim file into multiple read-only split .swm files.

此选项将在指定的目录中创建 .swm 文件,并根据相同的 path_to_swm 指定值将每个文件命名,但在名称中追加一个编号。This option creates the .swm files in the specified directory, naming each file the same as the specified path_to_swm, but with an appended number. 例如,如果将 path_to_swm 设置为 c:\Data.swm,则此选项将创建类似于 Data.swm、Data2.swm、Data3.swm 的文件,定义 .wim 拆分文件的每个部分,并将其保存到 C:\ 目录。For example, if you set path_to_swm as c:\Data.swm, this option creates a Data.swm file, a Data2.swm file, a Data3.swm file, and so on, defining each portion of the split .wim file and saving it to the C:\ directory.

此命令行选项不适用于虚拟硬盘 (VHD) 文件。This command-line option does not apply to virtual hard disk (VHD) files.

WIM 的语法:Syntax for WIM:

Dism /Split-Image /ImageFile:<path_to_image_file> /SWMFile:<path_to_swm> /FileSize:<MB-Size> [/CheckIntegrity]
参数Parameter 说明Description
/FileSize/FileSize 指定每个已创建文件的最大大小 (MB)。Specifies the maximum size in megabytes (MB) for each created file. 如果单个文件大于 /FileSize 选项中指定的值,则生成的 .swm 拆分文件之一将大于 /FileSize 选项中指定的值,以容纳大文件。If a single file is larger than the value specified in the /FileSize option, one of the split .swm files that results will be larger than the value specified in the /FileSize option, in order to accommodate the large file.
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/ImageFile/ImageFile 指定某个映像文件(例如 install.wim)的路径。Specifies the path of an image file, example: install.wim.

例如:Example:

Dism /Split-Image /ImageFile:install.wim /SWMFile:split.swm /FileSize:650

/Unmount-Image/Unmount-Image

卸载 .ffu、.wim、.vhd 或 .vhdx 文件,并提交或丢弃装载映像时所做的更改。Unmounts the .ffu, .wim, .vhd or .vhdx file and either commits or discards the changes that were made when the image was mounted.

使用 /Unmount-Image 选项时,必须使用 /commit 或 /discard 参数。You must use either the /commit or /discard argument when you use the /Unmount-Image option.

语法:Syntax:

Dism /Unmount-Image /MountDir:<path_to_mount_directory> {/Commit | /Discard} [/CheckIntegrity] [/Append]
参数Parameter 说明Description
/CheckIntegrity/CheckIntegrity 与 capture、unmount、export 和 commit 操作结合使用时,可检测和跟踪 .wim 文件损坏情况。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 将 /CheckIntegrity 与 apply 和 mount 操作结合使用时,如果 DISM 检测到 .wim 文件已损坏,则此参数将停止操作。/CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Append/Append 将修改的映像添加到现有的 .wim 文件,而不是覆盖原始映像。Adds the modified image to the existing .wim file instead of overwriting the original image. /CheckIntegrity 和 /Append 参数不适用于虚拟硬盘(VHD、VHDX)或 FFU 文件。The /CheckIntegrity and /Append arguments do not apply to virtual hard disk (VHD, VHDX), or FFU files.

示例:Examples:

Dism /Unmount-Image /MountDir:C:\test\offline /commit
Dism /Unmount-Image /MountDir:C:\test\offline /discard

/Update-WIMBootEntry/Update-WIMBootEntry

使用已重命名的映像文件或已移动的映像文件路径,来更新与指定的数据源 ID 关联的 WIMBoot 配置条目。Updates the WIMBoot configuration entry, associated with the specified data source ID, with the renamed image file or moved image file path.

注意: /Update-WIMBootEntry 要求重启,这样才能使任何更新生效。Note: /Update-WIMBootEntry requires a restart in order for any updates to take effect.

语法:Syntax:

Dism /Update-WIMBootEntry /Path:<Volume_path> /DataSourceID:<Data_source_id> /ImageFile:<Renamed_image_path>
参数Parameter 说明Description
/Path/Path 指定 WIMBoot 配置的磁盘卷。Specifies the disk volume of the WIMBoot configuration.
/DataSourceID/DataSourceID 指定 /Get-WIMBootEntry 显示的数据源 ID。Specifies the data source ID as displayed by /Get-WIMBootEntry.

例如:Example:

DISM.exe /Update-WIMBootEntry /Path:C:\ /DataSourceID:0 /ImageFile:R:\Install.wim

/Apply-SiloedPackage/Apply-SiloedPackage

将一个或多个孤立的预配包 (SPP) 应用到指定的映像。Applies one or more siloed provisioning packages (SPPs) to a specified image. 仅当从适用于 Windows 10 版本 1607 的 ADK 运行 CopyDandI.cmd,并从 CopyDandI.cmd 创建的目标文件夹运行 dism.exe /Apply-SiloedPackage 之后,此选项才可用。This option is only available after running CopyDandI.cmd from the ADK for Windows 10, Version 1607, and running dism.exe /Apply-SiloedPackage from the target folder created by CopyDandI.cmd.

注意: /Apply-SiloedPackage 只能针对 Windows 映像运行一次,但 /PackagePath 可在同一命令中使用多次,以应用多个 SPP。Note: /Apply-SiloedPackage can only be run once against a Windows image, but /PackagePath can used more than once in the same command to apply multiple SPPs. SPP 将按指定的顺序应用,因此应先指定依赖项,然后再指定依赖于它的 SPP。SPPs will be applied in the specified order, so a dependency should be specified before the SPP that depends on it.

有关孤立的预配包的详细信息以及如何使用 CopyDandI.cmd,请参阅孤立的预配包For more information about siloed provisioning packages, and how to use CopyDandI.cmd, see Siloed provisioning packages.

若要了解如何使用孤立的预配包,请参阅实验 10:使用孤立的预配包 (SPP) 添加桌面应用程序和设置To find out how to work with siloed provisioning packages, see Lab 10: Add desktop applications and settings with siloed provisioning packages (SPPs).

/Apply-SiloedPackage /PackagePath:<package_path> /ImagePath:<applied_image_path>
参数Parameter 说明Description
/PackagePath/PackagePath 指定孤立的预配包文件的路径。Specifies the path of a siloed provisioning package file.
/ImagePath/ImagePath 指定要在其中应用 SPP 的 Windows 映像的路径。Specifies the path of the Windows image where you are applying the SPP.

例如:Example:

Dism.exe /apply-SiloedPackage /PackagePath:C:\test\Word.spp /PackagePath:C:\test\spp2.spp /ImagePath:C:\

相关主题Related topics

DISM - Windows 的部署映像服务和管理技术参考DISM - Deployment Image Servicing and Management Technical Reference for Windows

什么是 DISM?What is DISM?

DISM 命令行语法的全局选项DISM Global Options for Command-Line Syntax

使用完整闪存更新 (FFU) 部署 WindowsDeploy Windows using Full Flash Update (FFU)

WIM、VHD 与FFU:映像文件格式的比较WIM vs. VHD vs. FFU: comparing image file formats