次の方法で共有


DISM Global Options for Command-Line Syntax

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

Global options can be added to most of the servicing and imaging options in the Deployment Image Servicing and Management (DISM) tool. These options can be used to access the command-line help, specify the location of files to use, and control logging.

Basic Syntax for Servicing Commands

After you have mounted or applied a Windows® image so that it is available offline as a flat file structure, you can specify any DISM global options, the servicing option that will update your image, and the location of the offline image. You can use only one servicing option per command line.

If you are servicing a running computer, you can use the /Online option instead of specifying the location of the offline Windows image. The commands and options that are available for servicing an image depend on which Windows operating system you are servicing. They also depend on whether the image is offline or a running operating system. All commands work on an offline Windows image. Subsets of the commands are available for servicing a running operating system.

The base syntax for DISM servicing commands is:

DISM.exe {/Image:<path_to_image> | /Online} [dism_global_options] {servicing_option} [<servicing_argument>]

For more information about servicing commands, see Deployment Image Servicing and Management (DISM) Command-Line Options.

Basic Syntax for Imaging Commands

Many of the global options are also available for imaging commands. The base syntax for DISM imaging commands is:

DISM.exe [dism_global_options] {servicing_option} [<servicing_argument>]

For more information about using DISM for image management, such as applying or mounting an image, see DISM Image Management Command-Line Options.

Global Options for Servicing and Imaging Commands

The following DISM global options are available for an offline image.

DISM.exe /image:<path_to_offline_image_directory> [/WinDir:<path_to_%WINDIR%>] [/LogPath:<path_to_log_file.log>] [/LogLevel:<n>] [/SysDriveDir:<path_to_bootMgr_file>] [/Quiet] [/NoRestart] [/ScratchDir:<path_to_scratch_directory>] [/English] [/Format:<output_format> ]

The following DISM global options are available for a running operating system.

DISM.exe /online [/LogPath:<path_to_log_file>] [/LogLevel:<n>] [/SysDriveDir:<path_to_bootMgr_file>] [/Quiet] [/NoRestart] [/ScratchDir:<path_to_scratch_directory>] [/English] [/Format:<output_format> ]

The following table provides a description of how each DISM global option can be used. These options are not case sensitive.

Global option Description

/Get-Help

/?

Displays information about available DISM command-line options and arguments.

Use the /? or /Get-Help option without specifying an image file to get help on image management commands such as /Mount-Image.

Example:

Dism /?

Specify an image file with the /Image:<path_to_an_image> option or use the /Online option to get help on the servicing command in the image, such as /Get-Packages. The options that are available for servicing an image depend on the servicing technology that is available in your image.

Example:

Dism /image:C:\test\offline /?

Dism /online /?

You can display additional Help by specifying a command-line option.

Example:

Dism /image:C:\test\offline /Add-Driver /?

Dism /image:C:\test\offline /Add-Package /?

Dism /online /Get-Drivers /?

/LogPath:<path to log file.log>

Specifies the full path and file name to log to. If not set, the default is: %WINDIR%\Logs\Dism\dism.log

Important
In Windows PE, the default directory is the RAMDISK scratch space which can be as low as 32 MB.

The log file will automatically be archived. The archived log file will be saved with .bak appended to the file name and a new log file will be generated. Each time the log file is archived the .bak file will be overwritten.

When using a network share that is not joined to a domain, use the net use command together with domain credentials to set access permissions before you set the log path for the DISM log.

Example:

Dism /image:C:\test\offline /LogPath:AddPackage.log /Add-Package /PackagePath:C:\packages\package.cab

/LogLevel:<n>

Specifies the maximum output level shown in the logs. The default log level is 3. The accepted values are as follows:

1 = Errors only

2 = Errors and warnings

3 = Errors, warnings, and informational

4 = All of the information listed previously, plus debug output

Example:

Dism /image:C:\test\offline /LogPath:AddPackage.log /LogLevel:1 /Add-Package /PackagePath:C:\packages\package.cab

/Image:<path_to_offline_image_directory>

This is the full path to the root directory of the offline Windows image that you will service. If the directory named Windows is not a subdirectory of the root directory, /WinDir must be specified.

This option cannot be used with /Online.

Example:

Dism /image:C:\test\offline /LogPath:AddPackage.log /LogLevel:1 /Add-Package /PackagePath:C:\packages\package.cab

/WinDir:<path_to_%WINDIR%>

Used with the /Image option to specify the path to the Windows directory relative to the image path. This cannot be the full path to the Windows directory; it should be a relative path. If not specified, the default is the Windows directory in the root of the offline image directory.

This option cannot be used with the /Online option.

Example:

Dism /image:C:\test\offline /WinDir:WinNT /Add-Package /PackagePath:C:\packages\package.cab

/Online

Specifies that the action is to be taken on the operating system that is currently running.

This option cannot be used with the /Image or the /WinDir option. When /Online is used the Windows directory for the online image is automatically detected.

Example:

Dism /online /Get-Packages

/SysDriveDir:<path_to_sysdrive_directory>

Use /SysDriveDir to service an installed Windows image from a Windows PE environment.

The /SysDriveDir option specifies the path to the location of the BootMgr files. This is necessary only when the BootMgr files are located on a partition other than the one that you are running the command from.

For example, at a Windows PE command prompt, type:

Dism /image:C:\Windows /SysDriveDir:C:\

/Quiet

Turns off information and progress output to the console. Only error messages will be displayed.

To run in quiet mode, this option must be set every time that the command-line utility is run.

Note

Do not use the /Quiet option with /Get commands. No information will be displayed.

Example:

Dism /image:C:\test\offline /Add-Package /PackagePath:C:\packages\package.cab /quiet

/NoRestart

Suppresses reboot. If a reboot is not required, this command does nothing. This option will keep the application from prompting for a restart (or keep it from restarting automatically if the /Quiet option is used).

Example:

Dism /online /Add-Package /PackagePath:C:\packages\package.cab /NoRestart /quiet

/ScratchDir:<path_to_scratchdirectory>

Specifies a temporary directory that will be used when extracting files for temporary use during servicing. The directory must exist locally. If not specified, the \Windows\%Temp% directory will be used, with a subdirectory name of randomly generated hexadecimal value for each run of DISM. Items in the scratch directory are deleted after each operation.

You should not use a network share location as a scratch directory to expand a package (.cab or .msu file) for installation. The directory used for extracting files for temporary usage during servicing should be a local directory.

Example:

Dism /image:C:\test\offline /ScratchDir:C:\Scratch /Add-Package /PackagePath:C:\packages\package.cab

/English

Displays command-line output in English.

Note

Some resources cannot be displayed in English.
This option is not supported when you use the DISM /? command.

Example:

Dism /Get-ImageInfo /ImageFile:C:\test\offline\install.wim /index:1 /English

/Format:{Table | List}

Specifies the report output format.

Example:

Dism /Image:C:\test\offline /Get-Apps /Format:table

See Also

Reference

DISM Application Servicing Command-Line Options
DISM Windows Edition-Servicing Command-Line Options
DISM Languages and International Servicing Command-Line Options
DISM Operating System Package Servicing Command-Line Options
DISM Driver Servicing Command-Line Options
DISM Unattended Servicing Command-Line Options
DISM Windows PE Servicing Command-Line Options

Other Resources

Deployment Image Servicing and Management (DISM) Command-Line Options