powercfg
A component of | |
---|---|
Details | |
Type | Command-line utility |
Included with |
Windows XP SP2 Windows Vista Windows Server 2008 Windows 7 Windows 8[1] Windows 8.1 Windows Server 2012 Windows 10 |
Related components | |
PowerCFG (executable name powercfg.exe
) is a command-line utility that is used from an elevated Windows Command Prompt to control all configurable power system settings, including hardware-specific configurations that are not configurable through the Control Panel, on a per-user basis. It was first introduced by Microsoft in Windows XP SP2 in 2003.[2][3]
Usage
Powercfg must be run from an elevated command prompt, and, under Windows XP, it requires workstation Administrator or power user rights. Power Schemes are configured on a per-user basis. The most common cause of problems with power saving and hibernation on Windows systems is an incompatible device driver. This can be diagnosed by disabling each device in turn (with powercfg /devicedisablewake
). When activating power saving across a local area network, it is important to ensure that software updates, security patches and antivirus updates in particular, are not disrupted. Microsoft recommends to configure its Windows Server Update Services to install updates when workstations are available and Windows Task Scheduler can be set to wake the machine when needed.
Syntax
- XP
POWERCFG [/LIST | /QUERY [name] | /CREATE name | /DELETE name | /SETACTIVE name | /CHANGE name settings | /HIBERNATE {ON|OFF} | /NUMERICAL int | /EXPORT name [/FILE filename] | /IMPORT name [/FILE filename] | /GLOBALPOWERFLAG {ON|OFF} /OPTION flag | /BATTERYALARM {LOW|CRITICAL} [settings] | /DEVICEQUERY flagquery | /DEVICEENABLEWAKE devicename | /DEVICEDISABLEWAKE devicename | /?]
- Vista, Server 2008, 7
powercfg [/l[ist]] [/q[uery] [Scheme_GUID] [Sub_GUID]] ] [/x setting value] [/changename GUID name [scheme_description]] [/duplicatescheme GUID [DestinationGUID]] [/d[elete] GUID] [/deletesetting Sub_GUID Setting_GUID] [/s[etactive] Scheme_GUID] [/getactivescheme] [/setacvalueindex Scheme_GUID Sub_GUID Setting_GUID SettingIndex] [/setdcvalueindex Scheme_GUID Sub_GUID Setting_GUID SettingIndex] [/h[ibernate] [on|off]] [/a[vailablesleepstates]] [/devicequery query_flags] [/deviceenablewake devicename] [/devicedisablewake devicename] [/import filename [GUID]] [/export filename [GUID]] [/lastwake] [/aliases] [/setsecuritydescriptor [GUID|Action] SDDL] [/getsecuritydescriptor [GUID|Action]] [/requests] [/requestsoverride Caller_type Name Request] [/energy [/output filename] [/xml] [/duration seconds] [/trace [/d filepath]] [/waketimers] [/?]
Parameters
Parameter | Description | XP | Other OSs | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
/l[ist] |
Lists all power schemes in the current user's environment. | Yes | Yes | ||||||||||||||||||||||||
/q[uery] [scheme_name] (XP)/q[uery] [Scheme_GUID] [Sub_GUID] |
|
Displays the contents of the specified power scheme.
Yes | Yes | ||||||||||||||||||||||||
/c[reate] scheme_name |
scheme_name . |
Creates a power scheme with the specified Yes | No | ||||||||||||||||||||||||
/change setting value |
|
Modifies a setting value in the current power scheme.
Yes | Yes | ||||||||||||||||||||||||
/changename GUID PowerSchemeName [scheme_description] |
|
Modifies the name of a power scheme and, optionally, the scheme description.
No | Yes | ||||||||||||||||||||||||
/duplicatescheme GUID [DestinationGUID] |
|
Duplicates the specified power scheme. The resulting GUID which represents the new scheme will be displayed.
No | Yes | ||||||||||||||||||||||||
/d[elete] scheme_name /d[elete] GUID |
|
Deletes the power scheme with the specified GUID.
Yes | Yes | ||||||||||||||||||||||||
/deletesetting Sub_GUID Setting_GUID |
|
Deletes a power setting.
No | Yes | ||||||||||||||||||||||||
/s[etactive] scheme_name |
|
Makes the specified power scheme active on the computer.
Yes | Yes | ||||||||||||||||||||||||
/getactivescheme |
Retrieves the currently active power scheme. | No | Yes | ||||||||||||||||||||||||
/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.
No | Yes | ||||||||||||||||||||||||
/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.
No | Yes | ||||||||||||||||||||||||
/h[ibernate] [on|off] |
Enables or disables the hibernate feature. Hibernate timeout is not supported on all computers. | Yes | Yes | ||||||||||||||||||||||||
/n[umerical] |
This switch allows a number to be used in place of the scheme_name in the following commands: /QUERY , /DELETE , /SETACTIVE , /CHANGE , /EXPORT , and /IMPORT |
Specify the power scheme to be operated upon with a numerical identifier. Yes | No | ||||||||||||||||||||||||
/g[lobalpowerflag] [on|off]] |
|
Turn one of the following global power flags on or off:
Yes | No | ||||||||||||||||||||||||
/b[atteryalarm] [low|critical] [settings] |
Settings:
|
Configure the battery alarm. Yes | No | ||||||||||||||||||||||||
/a[vailablesleepstates] |
Reports the sleep states available on the computer. Attempts to report reasons why sleep states are unavailable. | Yes | Yes | ||||||||||||||||||||||||
/devicequery [query_flags]] |
|
Returns a list of devices that meet the specified flags:
Yes | Yes | ||||||||||||||||||||||||
/deviceenablewake devicename |
|
Enables the device to wake the computer from a sleep state.
Yes | Yes | ||||||||||||||||||||||||
/devicedisablewake <devicename> |
|
Disables the device from waking the computer from a sleep state.
Yes | Yes | ||||||||||||||||||||||||
/import scheme_name [/FILE filename] |
|
Imports all power settings from the specified file.
Yes | Yes | ||||||||||||||||||||||||
/export scheme_name [/FILE filename] |
|
Exports a power scheme, represented by the specified GUID, to the specified file.
Yes | Yes | ||||||||||||||||||||||||
/lastwake |
Reports information about the event that woke the computer from the last sleep transition. | No | Yes | ||||||||||||||||||||||||
/aliases |
Displays all aliases and their corresponding GUIDs. The user may use these aliases in place of any GUID at the command prompt | No | Yes | ||||||||||||||||||||||||
/setsecruitydescriptor [GUID|Action] SDDL |
|
Sets a security descriptor associated with a specified power setting, power scheme, or action.
No | Yes | ||||||||||||||||||||||||
/getsecuritydescriptor [GUID|<Action>] |
|
Gets a security descriptor associated with a specified power setting, power scheme, or action.
No | Yes | ||||||||||||||||||||||||
/requests |
Enumerate application and driver Power Requests. Power requests prevent the computer from automatically powering off the display or entering a low-power sleep mode. | No | Yes | ||||||||||||||||||||||||
/requestsoverride Caller_type Name Request |
|
Sets a Power Request override for a particular Process, Service, or Driver. If no parameters are specified, this command displays the current list of Power Request Overrides. NOTE: No documentation exists to remove a request override entry once entered, however leaving off the request type will do so. powercfg -requestsoverride Caller_type Name (Request left blank to remove entry)
No | Yes | ||||||||||||||||||||||||
/energy |
/energy command should be used when the computer is idle and with no open programs or documents. The /energy command will generate an HTML report file in the current path. Windows7 only.
|
Analyzes the system for common energy-efficiency and battery life problems. The No | 7 only | ||||||||||||||||||||||||
/waketimers |
Enumerates the active wake timers. If enabled, the expiration of a wake timer wakes the system from sleep and hibernate states. | No | Yes | ||||||||||||||||||||||||
/help |
Displays Help at the command prompt. | Yes | Yes |
- Power scheme GUIDs
The use of GUIDs avoids any problems with internationalisation when applying Power Saving to non-English versions of Windows. The three built-in power schemes have the GUIDs listed below:
SCHEME_MAX
= Power saver (Max power saving)SCHEME_BALANCED
= Balanced (Typical)SCHEME_MIN
= High performance (Min power saving)
Examples
Lists all power schemes
powercfg /l
List all Aliases
powercfg -aliases
Retrieve the currently active power scheme
powercfg -getactivescheme
Set the Monitor and disc timeouts for the current Power saver scheme
powercfg -Change -monitor-timeout-ac 20 powercfg -Change -disk-timeout-ac 30
Enable the mouse to wake from sleep
powercfg -deviceEnableWake "Microsoft USB IntelliMouse Explorer"
Set the 'Power saver' scheme
powercfg -SETACTIVE SCHEME_MAX
Create a Custom Power scheme and set it as active
Set _Custom_Power=B1234567-SS64-SS64-SS64-F00000111AAA
powercfg -DUPLICATESCHEME SCHEME_MAX %_Custom_Power%
powercfg -CHANGENAME %_Custom_Power% "SS64 Power Scheme "
powercfg -SETACTIVE %_Custom_Power%
Disable the sleep button (for the users current power scheme)
For /f "tokens=2 delims=:(" %%G in ('powercfg -getActiveScheme') do (
powercfg -setAcValueIndex %%G sub_buttons sButtonAction 0
powercfg -setActive %%G
)
Disable the sleep button (for all available power schemes)
For /f "skip=2 tokens=2,4 delims=:()" %%G in ('powercfg -list') do (
powercfg -setAcValueIndex %%G sub_buttons sButtonAction 0
if "%%H" == " *" powercfg -setActive %%G
)
See also
References
- ↑ "Powercfg Command-Line Options". Microsoft.
- ↑ "PowerCFG (Windows XP SP2/2003)". SS64.com.
- ↑ "PowerCFG (Vista/Windows7/Server 2008)". SS64.com.
External links
- "Powercfg" (ASPX). Microsoft. 17 April 2012.
- "How to use Powercfg.exe to create a Group Policy object for power schemes in Windows XP". Microsoft. 12 April 2012.