Поделиться через


Powercfg Command-Line Options

You can use the Powercfg.exe tool to control power settings and configure computers to default to Hibernate or Standby modes.

The Powercfg.exe tool is installed with Windows.

Powercfg Command-Line Options

The following command-line options are available for Powercfg.

powercfg [-l] [-q ] [-x] [-changename] [-duplicatescheme] [-d] [-deletesetting] [-setactive] [-getactivescheme] [-setacvalueindex] [-setdcvalueindex] [-h] [-a] [-devicequery] [-deviceenablewake] [-devicedisablewake] [-import] [-export] [-lastwake] [-?] [-aliases] [-setsecuritydescriptor] [-getsecuritydescriptor]

Option Description

-list

-l

Lists all power schemes in the current user's environment.

Example:

powercfg -list

-query [Scheme_GUID] [Sub_GUID]

-q [Scheme_GUID] [Sub_GUID]

Displays the contents of the specified power scheme.

Usage:

powercfg -query [Scheme_GUID] [Sub_GUID]

SCHEME_GUID

(Optional) Specifies the GUID of the power scheme to display. Can be obtained by using the powercfg -l command.

SUB_GUID

(Optional) Specifies the GUID of the subgroup to display. Requires a SCHEME_GUID to be provided.

If neither SCHEME_GUID or SUB_GUID are provided, the settings of the current user's active power scheme are displayed.

If SUB_GUID is not specified, all settings in the specified power scheme are displayed.

-change settingvalue

-x setting value

Modifies a setting value in the current power scheme.

Usage:

powercfg–x setting value

setting

Specifies one of the following settings:

-monitor-timeout-ac minutes

-monitor-timeout-dc minutes

-disk-timeout-ac minutes

-disk-timeout-dc minutes

-standby-timeout-ac minutes

-standby-timeout-dc minutes

-hibernate-timeout-ac minutes

-hibernate-timeout-dc minutes

value

Specifies the value in minutes.

Example:

powercfg-change-monitor-timeout-ac5

This sets the monitor idle timeout value to five minutes when operating on AC power.

-changename GUID name [scheme_description]

Modifies the name of a power scheme and, optionally, the scheme description.

Usage:

powercfg–changename GUID namescheme_description

GUID

Specifies the GUID of the power scheme

Name

Specifies the name of the power scheme.

scheme_description

Describes the power scheme.

If the description is omitted, then only the name will be changed.

-duplicatescheme GUID [DestinationGUID]

Duplicates the specified power scheme. The resulting GUID which represents the new scheme will be displayed.

Usage:

powercfg–duplicatescheme GUID [DestinationGUID]

GUID

Specifies a scheme GUID. Obtained by using the powercfg-l command.

DestinationGUID

Specifies the GUID where the scheme will be copied.

If DestinationGUID is omitted, then a new GUID will be created for the duplicated scheme.

-delete GUID

-d GUID

Deletes the power scheme with the specified GUID.

Usage:

Powercfg–delete GUID

GUID

Specifies the GUID of the scheme. Obtained by using the -list option.

-deletesetting Sub_GUID Setting_GUID

Deletes a power setting.

Usage:

powercfg–deletesetting Sub_GUID Setting_GUID

Sub_GUID

Specifies the subgroup GUID.

Setting_GUID

Specifies the power setting GUID.

-setactive Scheme_GUID

-s Scheme_GUID

Makes the specified power scheme active on the computer.

Usage:

Powercfg–setactive Scheme_GUID

Scheme_GUID

Specifies the scheme GUID.

-getactivescheme

Retrieves the currently active power scheme.

Usage:

Powercfg-getactivescheme

-setacvalueindex Scheme_GUID Sub_GUID Setting_GUID SettingIndex

Sets a value associated with a specified power setting while the computer is powered by AC power.

Usage:

powercfg–setacvalueindex Scheme_GUIDSub_GUIDSetting_GUIDSettingIndex

Scheme_GUID

Specifies a power scheme GUID. Obtained by using the -l option.

Sub_GUID

Specifies a subgroup of power setting GUID. Obtained by using the -q option.

Setting_GUID

Specifies an individual power setting GUID. Obtained by using the -q option.

SettingIndex

Specifies which of the list of possible values this power setting will be set to.

Example:

powercfg–setacvalueindex Scheme_GUID Sub_GUID Setting_GUID 5

This sets the power setting's AC value to the fifth entry in the list of possible values for this power setting.

-setdcvalueindex Scheme_GUID Sub_GUID Setting_GUID SettingIndex

Sets a value associated with a specified power setting while the computer is powered by DC power.

Usage:

powercfg–setdcvalueindex Scheme_GUID Sub_GUID Setting_GUID SettingIndex

Scheme_GUID

Specifies a power scheme GUID. Obtained by using the -l option.

Sub_GUID

Specifies a subgroup of power setting GUID. Obtained by using the -q option.

Setting_GUID

Specifies an individual power setting GUID. Obtained by using the -q option.

SettingIndex

Specifies which of the list of possible values this power setting will be set to.

Example:

powercfg–setdcvalueindex Scheme_GUID Sub_GUID Setting_GUID 5

This sets the power setting's DC value to the fifth entry in the list of possible values for this power setting.

-hibernate [on|off]

-h [on|off]

Enables or disables the hibernate feature. Hibernate timeout is not supported on all computers.

Example: powercfg-h on

-availablesleepstates

-a

Reports the sleep states available on the computer. Attempts to report reasons why sleep states are unavailable.

-devicequery query_flags

Returns a list of devices that meet the specified criteria.

Usage:

powercfg–devicequery query_flags

query_flags

Specifies one of the following criteria:

wake_from_S1_supported – Returns all devices that support waking the computer from a light sleep state.

wake_from_S2_supported – Returns all devices that support waking the computer from a deeper sleep state.

wake_from_S3_supported – Returns all devices that support waking the computer from the deepest sleep state.

wake_from_any – Returns all devices that support waking the computer from any sleep state.

S1_supported – Lists devices supporting light sleep.

S2_supported – Lists devices supporting deeper sleep.

S3_supported – Lists devices supporting deepest sleep.

S4_supported – Lists devices supporting hibernation.

wake_programmable – Lists devices that are user-configurable to wake the computer from a sleep state.

wake_armed – Lists devices that are currently configured to wake the computer from any sleep state.

all_devices – Returns all devices present in the computer.

all_devices_verbose – Returns a verbose list of devices.

Example:

powercfg -devicequery wake_armed

-deviceenablewake devicename

Enables the device to wake the computer from a sleep state.

Usage:

powercfg–deviceenablewake devicename

devicename

Specifies a device retrieved by using the powercfg-devicequerywake_programmable command.

Example:

powercfg-deviceenablewake"Microsoft USB IntelliMouse Explorer"

-devicedisablewake devicename

Disables the device from waking the computer from a sleep state.

Usage:

powercfg–devicedisablewake devicename

devicename

Specifies a device retrieved by using the powercfg-devicequerywake_armed command.

-import filename [GUID]

Imports all power settings from the specified file.

Usage:

powercfg–import filename [GUID]

filename

Specifies a fully qualified path to a file generated by using the powercfg-export option.

GUID

(optional) Represents the settings loaded into a power scheme. If not supplied, Powercfg will generate and use a new GUID

Example:

powercfg-importc:\scheme.pow

-export filename GUID

Exports a power scheme, represented by the specified GUID, to the specified file.

Usage:

powercfg -export filename GUID

filename

Specifies a fully qualified path to a destination file.

GUID

Specifies a power scheme GUID. Obtained by using the /l option.

Example:

powercfg -export c:\scheme.pow 381b4222-f694-41f0-9685-ff5bb260df2e

-lastwake

Reports information about the event that woke the computer from the last sleep transition.

-help

-?

Displays information about the Powercfg command-line options.

-aliases

Displays all aliases and their corresponding GUIDs. The user may use these aliases in place of any GUID at the command prompt

-setsecruitydescriptor [GUID|Action] SDDL

Sets a security descriptor associated with a specified power setting, power scheme, or action.

Usage:

powercfg -setsecuritydescriptor [GUID|Action] SDDL

GUID

Specifies a power scheme or a power setting GUID.

Action

Specifies one of the following strings: ActionSetActive, ActionCreate, ActionDefault

SDDL

Specifies a valid security descriptor string in SDD format. Call powercfg -getsecuritydescriptor to see an example SDDL STRING.

-getsecuritydescriptor [GUID|Action]

Gets a security descriptor associated with a specified power setting, power scheme, or action.

Usage:

powercfg -getsecuritydescriptor [GUID|Action]

GUID

Specifies a power scheme or a power setting GUID.

Action

Specifies one of the following strings: ActionSetActive, ActionCreate, ActionDefault

See Also

Concepts

Command-Line Tools Technical Reference