Partager via


Using the Windows Management Instrumentation Command-line (WMIC) tool

The Windows Management Instrumentation Command-line (WMIC) is a command-line and scripting interface that simplifies the use of Windows Management Instrumentation (WMI) and systems managed through WMI.

WMIC is based on aliases. Aliases make the primary data provided by WMI available without having to understand WMI-specific concepts. WMI data and many WMI features are also accessible through WMI without aliases.

You can list the available aliases by using WMIC /? help. WMIC has a progressive help system. You can use /? at any time and at any depth to discover the additional options that are available in the current context. /? lists the currently available aliases, commands, and the global switches (that is, switches that apply to WMIC overall). To list the verbs and switches available for an alias, type the name of the alias and /?. To list the parameters available for a particular verb, type the name of the alias, the verb, and then /?.

For example, the processes running on the current system are available from the PROCESS alias. To view all of the processes that are currently running on the computer, type PROCESS in the WMIC utility. To list a specific process, type a command such as PROCESS WHERE (Description="explorer.exe"). To receive specific properties for the processes, type a command such as PROCESS GET Name, Handle, PageFaults.

Without using aliases, you can use the same options with the CLASS command. For example, CLASS Win32_Process GET Name, Handle, PageFaults. However, you must determine the name of the class from other sources. To do the equivalent of the alias Where clause, you must use PATH Win32_Process.Description="explorer.exe".

For more information about using and extending WMIC, see WMI Command-line in Windows XP Help. This documentation includes information about using WMIC in batch files, for reporting, with remote and multiple computers, and for system management.

Command

Result

/?

Displays help.

CLASS

Escapes from the default alias mode of WMIC to access classes in the WMI schema directly.

PATH

Escapes from the default alias mode of WMIC to access instances in the WMI schema directly.

CONTEXT

Displays the current values of all global switches.

QUIT

Exits WMIC.

EXIT

Exits WMIC.