Solved Change when the computer sleeps - from cmd line

rhinse

New member
Local time
1:12 AM
Messages
34
I ocassionally like to switch the time the computer goes to sleep from 'Never' to
'5 minutes' or thereabouts every so often. I have been looking for a way to
automate that process. Wading through control panel to the settings page takes
a while and I don't use a standard keyboard and mouse on my Media Center box
to navigate.

I can shorten it somewhat by creating a command line shortcut containing the following:

Code:
control /name Microsoft.PowerOptions
but this only gets me down about 2 layers and I still have to try to use an unweildy
mouse and keyboard to get to the next page and change the settings.

Is there any way to create another batch file or some other script that will
perform this function w/o having to change the settings from the window screens?
Perhaps a .reg file to change the setting in the registry, if that's where it is?
 

My Computer My Computer

At a glance

Windows Home Premium 32bitAMD Athlon II X2 255 Regor 3.1GHz Socket AM3Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual ...Sapphire 100287L Radeon HD5670 512MB PCI Expr...
Computer Manufacturer/Model Number
Custom
OS
Windows Home Premium 32bit
CPU
AMD Athlon II X2 255 Regor 3.1GHz Socket AM3
Motherboard
Gigabyte GA-870A-UD3 Rev.2.1
Memory
Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual Channel
Graphics Card(s)
Sapphire 100287L Radeon HD5670 512MB PCI Express 2.0 x16
Sound Card
Realtek onboard
Monitor(s) Displays
Samsung 56" HDTV
Hard Drives
Western Digital 3.5" 640GB SATA
PSU
Black Cooler Master eXtreme Power Plus 500W ATX12V V2.3
Case
Black Logisys Ikonik Taran A10 Mid Tower
Cooling
AMD CPU cooler, 2 120mm case fans

My Computer My Computer

At a glance

Windows 7 Ultimate SP1 x64i7 950 4ghz6GB G.Skill pc12800EVGA GTX 580 SC
Computer Manufacturer/Model Number
Custom build
OS
Windows 7 Ultimate SP1 x64
CPU
i7 950 4ghz
Motherboard
EVGA x58 FTW3
Memory
6GB G.Skill pc12800
Graphics Card(s)
EVGA GTX 580 SC
Sound Card
Xfi Titanium
Monitor(s) Displays
Samsung 24"
Screen Resolution
1920x1200
Hard Drives
Vertex 3 SSD 120Gb x2 RAID 0
4 x 1TB WD Black RAID 0
PSU
Thermaltake 850
Case
Mountain Mods U2-UFO Horizon
Cooling
Custom watercooling
Internet Speed
100 down 5 up

My Computer My Computer

At a glance

Windows 10 Pro X64Intel Quad Core i7-4770 @ 3.4Ghz16.0GB PC3-12800 DDR3 SDRAM 1600 MHzIntel Integrated HD Graphics
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
I had seen the references to changing power plans but thought that was
a bit excessive and unnecessary since I can change the settings
'When the computer sleeps' within the same power plan by changing the
settings in control panel.

Presumably, switching to an alternate power plan via the referenced
shortcuts would necessitate changing the 'Change when the computer sleeps'
setting under one particular alternate plan while retaining the default
for the other. This would not seem all that involved but when I made a
comparison of the Power registry key set to "Never" and "5 minutes", under
the same power plan, the only change was to the following key:

Never:
Code:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\
381b4222-f694-41f0-9685-ff5bb260df2e\
238c9fa8-0aad-41ed-83f4-97be242c8f20\
29f6c1db-86da-48c5-9fdb-f2b67b1f44da]
"ACSettingIndex"=dword:00000000
Five Minutes:
Code:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\
381b4222-f694-41f0-9685-ff5bb260df2e\
238c9fa8-0aad-41ed-83f4-97be242c8f20\
29f6c1db-86da-48c5-9fdb-f2b67b1f44da]
"ACSettingIndex"=dword:0000012c
Unfortunately, when I tried to place each different setting into .reg files and load them into the
registry, I got the following error message:

Code:
 Cannot import File.reg: Not all data was successfully wrtten to
the registry. Some keys are open by the system or other processes.
Apparently security configurations only allow the change to "ACSettingIndex" if it is done through the control panel.

I also do not wish to enter sleep/hybrid sleep mode with a command line entry, so
"Standby and Hibernate from Command Line" doesn't apply. I simply want to change
the idle time before the system enters sleep mode automatically.

While I haven't yet tested the shortcuts switching power plans, I wonder if there
isn't some other way to alter the "ACSettingIndex" under the same user. If Microsoft
allows it through Control Panel, it would seem possible.
 

My Computer My Computer

At a glance

Windows Home Premium 32bitAMD Athlon II X2 255 Regor 3.1GHz Socket AM3Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual ...Sapphire 100287L Radeon HD5670 512MB PCI Expr...
Computer Manufacturer/Model Number
Custom
OS
Windows Home Premium 32bit
CPU
AMD Athlon II X2 255 Regor 3.1GHz Socket AM3
Motherboard
Gigabyte GA-870A-UD3 Rev.2.1
Memory
Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual Channel
Graphics Card(s)
Sapphire 100287L Radeon HD5670 512MB PCI Express 2.0 x16
Sound Card
Realtek onboard
Monitor(s) Displays
Samsung 56" HDTV
Hard Drives
Western Digital 3.5" 640GB SATA
PSU
Black Cooler Master eXtreme Power Plus 500W ATX12V V2.3
Case
Black Logisys Ikonik Taran A10 Mid Tower
Cooling
AMD CPU cooler, 2 120mm case fans
OK, maybe not.

The shortcut files from the Power Plan Tutorial work well even though some
additional keys are added to the registry. It is unclear which ones actually
control the 'Sleep time' now but after changing the sleep time under one of
the power plans to 5 minutes and leaving the other at 'Never', I can switch
back and forth with one click.

The only change to the registry that occurs now is:

Code:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes]
"ActivePowerScheme"="381b4222-f694-41f0-9685-ff5bb260df2e"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PowerUser\PowerSchemes]
"ActivePowerScheme"="a1841308-3541-4fab-bc81-f71556f20b4a
 

My Computer My Computer

At a glance

Windows Home Premium 32bitAMD Athlon II X2 255 Regor 3.1GHz Socket AM3Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual ...Sapphire 100287L Radeon HD5670 512MB PCI Expr...
Computer Manufacturer/Model Number
Custom
OS
Windows Home Premium 32bit
CPU
AMD Athlon II X2 255 Regor 3.1GHz Socket AM3
Motherboard
Gigabyte GA-870A-UD3 Rev.2.1
Memory
Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual Channel
Graphics Card(s)
Sapphire 100287L Radeon HD5670 512MB PCI Express 2.0 x16
Sound Card
Realtek onboard
Monitor(s) Displays
Samsung 56" HDTV
Hard Drives
Western Digital 3.5" 640GB SATA
PSU
Black Cooler Master eXtreme Power Plus 500W ATX12V V2.3
Case
Black Logisys Ikonik Taran A10 Mid Tower
Cooling
AMD CPU cooler, 2 120mm case fans
There you go (change ac to dc for battery)
Code:
powercfg -change -standby-timeout-ac 20

More info:
Code:
  -CHANGE, -X Modifies a setting value in the current power scheme.

              Usage: POWERCFG -X <SETTING> <VALUE>

              <SETTING>   Specifies one of the following options:
                          -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>

              Example:
                  POWERCFG -Change -monitor-timeout-ac 5

              This would set the monitor idle timeout value to 5 minutes
              when on AC power.
 

My Computer My Computer

At a glance

Windows 10 Pro (x64)Intel Core i7-3930K (3.2GHz - 4.5GHz)4x Samsung 4GB PC3-12800 DDR3 (16GB 1600MHz)Nvidia Geforce GTX 690
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Alienware Aurora ALX R4
OS
Windows 10 Pro (x64)
CPU
Intel Core i7-3930K (3.2GHz - 4.5GHz)
Motherboard
Alienware Aurora-R4 x79
Memory
4x Samsung 4GB PC3-12800 DDR3 (16GB 1600MHz)
Graphics Card(s)
Nvidia Geforce GTX 690
Sound Card
SteelSeries Siberia Elite
Monitor(s) Displays
Dell UltraSharp U3011
Screen Resolution
2560x1600
Hard Drives
Samsung 850 Pro 256 GB, Seagate 1TB Desktop Hybrid HDD, 2x Western Digital 4TB Green HDD
PSU
875W Some Dell PSU <.<
Case
Alienware Aurora ALX
Cooling
Custom Liquid Cooling (EK CPU & GPU blocks) dual EK 480RAD
Keyboard
Logitech G710+ Mechanical
Mouse
Logitech G700s
Internet Speed
Verizon Fios (50 mbps average)
Other Info
Server: Intel NUC D54250WYK: i5-4250U, 16GB, 256 GB mSATA, Windows Server 2012 R2
Thanks, I knew there must be a way to do it!
Code:
powercfg -change -standby-timeout-ac
works perfectly w/o the registry bloat of changing Active Power Plan

Just out of curiosity, where did you get this info?
 

My Computer My Computer

At a glance

Windows Home Premium 32bitAMD Athlon II X2 255 Regor 3.1GHz Socket AM3Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual ...Sapphire 100287L Radeon HD5670 512MB PCI Expr...
Computer Manufacturer/Model Number
Custom
OS
Windows Home Premium 32bit
CPU
AMD Athlon II X2 255 Regor 3.1GHz Socket AM3
Motherboard
Gigabyte GA-870A-UD3 Rev.2.1
Memory
Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual Channel
Graphics Card(s)
Sapphire 100287L Radeon HD5670 512MB PCI Express 2.0 x16
Sound Card
Realtek onboard
Monitor(s) Displays
Samsung 56" HDTV
Hard Drives
Western Digital 3.5" 640GB SATA
PSU
Black Cooler Master eXtreme Power Plus 500W ATX12V V2.3
Case
Black Logisys Ikonik Taran A10 Mid Tower
Cooling
AMD CPU cooler, 2 120mm case fans
I got the information from "powercfg /?"
Anything that can be changed in the UI for power, can be done in the command line.
 

My Computer My Computer

At a glance

Windows 10 Pro (x64)Intel Core i7-3930K (3.2GHz - 4.5GHz)4x Samsung 4GB PC3-12800 DDR3 (16GB 1600MHz)Nvidia Geforce GTX 690
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Alienware Aurora ALX R4
OS
Windows 10 Pro (x64)
CPU
Intel Core i7-3930K (3.2GHz - 4.5GHz)
Motherboard
Alienware Aurora-R4 x79
Memory
4x Samsung 4GB PC3-12800 DDR3 (16GB 1600MHz)
Graphics Card(s)
Nvidia Geforce GTX 690
Sound Card
SteelSeries Siberia Elite
Monitor(s) Displays
Dell UltraSharp U3011
Screen Resolution
2560x1600
Hard Drives
Samsung 850 Pro 256 GB, Seagate 1TB Desktop Hybrid HDD, 2x Western Digital 4TB Green HDD
PSU
875W Some Dell PSU <.<
Case
Alienware Aurora ALX
Cooling
Custom Liquid Cooling (EK CPU & GPU blocks) dual EK 480RAD
Keyboard
Logitech G710+ Mechanical
Mouse
Logitech G700s
Internet Speed
Verizon Fios (50 mbps average)
Other Info
Server: Intel NUC D54250WYK: i5-4250U, 16GB, 256 GB mSATA, Windows Server 2012 R2
Anything that can be changed in the UI for power, can be done in the command line.
I would have thought the same, but until you came forward with the specifics, I
was at a loss. I've never tinkered much with power settings or any other Windows
settings for that matter, so I'm a babe in the woods about a lot of things.

Thanks for your help. I don't know when I have had a better outcome to a problem.
 

My Computer My Computer

At a glance

Windows Home Premium 32bitAMD Athlon II X2 255 Regor 3.1GHz Socket AM3Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual ...Sapphire 100287L Radeon HD5670 512MB PCI Expr...
Computer Manufacturer/Model Number
Custom
OS
Windows Home Premium 32bit
CPU
AMD Athlon II X2 255 Regor 3.1GHz Socket AM3
Motherboard
Gigabyte GA-870A-UD3 Rev.2.1
Memory
Kingston ValueRAM 2GB (2x1GB) DDR3 1333 Dual Channel
Graphics Card(s)
Sapphire 100287L Radeon HD5670 512MB PCI Express 2.0 x16
Sound Card
Realtek onboard
Monitor(s) Displays
Samsung 56" HDTV
Hard Drives
Western Digital 3.5" 640GB SATA
PSU
Black Cooler Master eXtreme Power Plus 500W ATX12V V2.3
Case
Black Logisys Ikonik Taran A10 Mid Tower
Cooling
AMD CPU cooler, 2 120mm case fans
Back
Top