共用方式為


DISM Configuration List and WimScript.ini Files

Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2

The Deployment Image Servicing and Management (DISM) tool is a command-line tool that you can use to capture and apply Windows images. You can create a configuration list file to determine the following:

  • Which files and folders must be excluded from the capture process when you use the /Capture-Image option with the DISM tool.

  • Which folders, files, and file types must be excluded from the compression process when you use the /Compress argument.

If you name your configuration list file wimscript.ini and store it in your DISM directory (where the DISM.exe file is located), it will automatically run when you use the /Capture-Image option (with or without the /Compress argument) without requiring you to use the /ConfigFile argument.

The /ConfigFile argument enables you to customize specific compression, capture, and boundary alignment actions for each file and folder when you capture an image using DISM.exe. You can create a configuration list (.ini) file by using a text editor, such as Notepad.

Creating a Configuration List File

The following sections appear in the DISM configuration list file.

Section Description

[ExclusionList]

Enables you to define the files and folders to exclude when you use the /Capture-Image option.

[ExclusionException]

Enables you to override the default exclusion list when you use the /Capture-Image option.

[CompressionExclusionList]

Enables you to define the specific files and folders, and also to specify file types, to exclude when you use the /Compress argument.

Note
You can use file or folder matching to exclude a file from compression. You can provide a full path match, or you can use wildcard characters (*). For example, you can use \WINDOWS\inf\*.pnf to match a specific type of file, or \WINDOWS\inf\* to match a whole folder.

Default Exclusion List

By default, the DISM.exe tool will exclude the following files.

[ExclusionList]
\$ntfs.log
\hiberfil.sys
\pagefile.sys
\swapfile.sys
"\System Volume Information"
\RECYCLER
\Windows\CSC

[CompressionExclusionList]
*.mp3
*.zip
*.cab
\WINDOWS\inf\*.pnf

Exclusion List Guidelines

  • You can only use wildcard characters in the last component in a file path that does not begin with a backslash. For example:

    myfolder\*.txt
    
  • You can use a preceding backslash to limit file-matching and directory-matching relative to the root directory. For example, you can use this exclusion list:

    \myfolder
    \folder\subfolder
    

    This list will exclude the following files and directories when you capture the "C:\" drive:

    C:\myfolder
    C:\folder\subfolder
    

    However, DISM will not exclude files or directories that are contained in the following example.

    C:\main\myfolder
    C:\data\folder\subfolder
    
  • You can override the default exclusion list by using the [ExclusionException] section. For example:

    [ExclusionException]
    \pagefile.sys
    "\System Volume Information"
    
  • If an explicit [ExclusionException] section is provided in the WIM configuration file, it will always take precedence over the [Exclusion List] section.

  • You cannot override the default compression exclusion list by using the [ExclusionException] section.

Using the Configuration File

If you create a custom-named configuration file and store it outside the DISM directory, you can use the DISM command to run the file. At a command prompt, open the DISM directory. For example:

Dism /Capture-Image /ImageFile:install.wim /CaptureDir:D:\ /Name:Drive-D /ConfigFile:<configuration list>

or

Dism /Append-Image /ImageFile:install.wim /CaptureDir:D:\ /Name:Drive-D /ConfigFile:<configuration list>

where <configuration list> provides the complete directory location for the configuration file. For example, c:\imaging\configuration_list.ini. You must use either the /Capture-Image option to create a new .wim file or the /Append-Image option to append an existing .wim file.

See Also

Reference

DISM Image Management Command-Line Options