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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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,此命令會將完整 Flash 公用程式 (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,此命令會將完整 Flash 更新 (.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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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. 在 WinPE 中搭配使用 /Apply-Image 與 /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 來套用及擷取擴充屬性 (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 以 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 選項在 compact 模式下套用映像,請確定 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. 若要從命令列取得裝置識別碼,請輸入 "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. 自訂 .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. 請勿切換 custom.wim 檔案或 install.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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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.

您可以擷取映像為完整 Flash 公用程式映像 (. 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. 指定要新增至映像的一或多個平台識別碼 (以分號分隔。Specifies one or more platform ids (separated with semicolon) to be added to the image. 如未指定,平台識別碼會是 '*'。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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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. /Compress 引數不適用於當您將映像匯出到現有的 .wim 檔案,只有將映像匯出到新的 .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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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. /Optimize-Image 僅用於 WIMBoot 支援的系統將使用的映像。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,此命令會將現有的完整 Flash 更新 (.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,請務必指定 /compress:none 選項來擷取 FFU。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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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.

此選項會在指定的目錄中建立 .sm 檔案,並如 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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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 在進行擷取、卸載、匯出、認可作業時搭配使用,可偵測和追蹤 wim 檔案損毀。Detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. 在進行套用、掛接作業時搭配使用,如果 DISM 偵測到 .wim 檔案損毀 /CheckIntegrity 會停止操作。/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

使用重新命名後的映像檔或移動後的映像檔路徑,更新與指定資料來源識別碼相關聯的 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 顯示的資料來源識別碼。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 的相依性,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.

如需了解如果使用獨立佈建套件,請參閱 Lab 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

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

WIM 與VHD 與FFU:比較映像檔案格式WIM vs. VHD vs. FFU: comparing image file formats