Questions tagged [powercfg]

Windows commands that controls power settings.

Documentation:

46 questions
1
vote
1 answer

How to ouput Powercfg /availablesleepstates into objects using powershell

Command line output: C:\powercfg -availablesleepstates The following sleep states are available on this system: Standby (S3) Hibernate Hybrid Sleep Fast Startup The following sleep states are not available on this system: …
1
vote
1 answer

How to find out hiberfil.sys size?

Curiously, although the hibernation file is located in the root directory, it could not be detected by PowerShell. Apparently this is a kind of virtual file. $Path = "$Env:SystemDrive\hiberfil.sys" # Result $False Test-Path -Path $Path # Result…
1
vote
3 answers

How to use Powercfg to set the active plan without using the GUID?

I wrote a batch file that imports a custom power plan using powercfg. It works but after running the script, I have to go in to the Windows Power Plan and manually select the plan for it to become active. I would prefer if the selection could be…
AsherV
  • 37
  • 1
  • 1
  • 8
1
vote
2 answers

How do I echo "Script Failed" if error is found?

I'm writing a batch file to import power plans in windows 10. My script is mostly done but I need a way to alert the user if there is an error. Ideally, the script would echo the exact error and prompt the user to hit a key to acknowledge it. Here's…
AsherV
  • 37
  • 1
  • 1
  • 8
1
vote
0 answers

energy.dll is missing, when starting powercfg from code

This is an addition to an Old Thread How to start `powercfg.exe -energy` from a .NET app? I'm trying to run powercfg /BatteryReport. It throws an error "The Energy Consumption Efficiency Diagnostic library (energy.dll) couldn't be loaded." This…
Mahobo
  • 105
  • 1
  • 16
1
vote
1 answer

How to change desktop background settings slideshow through powercfg using Python?

I'm running Python 2.7.11 on Windows 10 and I need to automatically pause and resume the desktop background slideshow for a program. My current approach is to issue commands to the command prompt thru Python's subprocess module. Below are the…
1
vote
0 answers

powercfg returns different results depending on 32-bit vs. 64-bit version

I was trying to call powercfg tool from my 32-bit application running on a 64-bit version of Windows 8.1 using CreateProcess with the following command as lpCommandLine parameter: "powercfg -waketimers" It worked fine, except that purely by chance…
c00000fd
  • 20,994
  • 29
  • 177
  • 400
1
vote
1 answer

Confirm current power plan via python

I'm trying to automate checking what the current power plan is and then return a response based on that. Here's what I have: import subprocess plan = subprocess.call("powercfg -getactivescheme") if 'Balanced' in plan: print Success When I…
Steve Smith
  • 168
  • 2
  • 10
1
vote
1 answer

Weird behavior of powercfg.exe when I execute it programatically

To programtically set display brightness I had two options : Use PowerWriteACValueIndex and PowerWriteDCValueIndex API Use PowerCfg.exe Now, I tried both, and both gave me the same (weird) result. Here's the code I'm using : With…
S. Saad
  • 336
  • 2
  • 9
1
vote
0 answers

Error "The Power Efficiency Diagnostic library (energy.dll) could not be loaded" when running powercfg.exe -batteryreport from .NET

I think this is not a duplicate question of How to start `powercfg.exe -energy` from a .NET app? In the other question, the OP has accepted an answer but the issue just resolved on its own so we don't know what is the solution (I'm not entirely…
Ryan Phung
  • 81
  • 1
  • 8
1
vote
1 answer

Execute a hidden process to retrieve the output, without creating a textfile?

I'm trying to execute a hidden process to retrieve the output. For this task I'm trying to use Exec method but the problem that I see is that I can't hide the process window?. I've seen an alternative way using Run method to start the process…
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
1
vote
1 answer

How does powercfg -energy detect the requested timer resolution

How does "powercfg -energy" command detect the requested timer resolution of each individual program running at the time? I imagine one way would be injecting into each of running processes and inside that process calling timeEndPeriod for each…
Roland Pihlakas
  • 4,246
  • 2
  • 43
  • 64
1
vote
1 answer

Duplicating and editing power settings using powercfg

I would like to use the powercfg tool in Windows to duplicate my current power scheme and then change the new scheme (enabling me to revert back to the old scheme if I mess something up) using a batch file. I know that powercfg -getactivescheme…
yiwei
  • 4,022
  • 9
  • 36
  • 54
0
votes
1 answer

How to check if monitor timeout is set to 'never'?

I know I can set the monitor timeout to 'never' using powercfg -change -monitor-timeout-ac 0 However, how can I check what the value of monitor timeout is? Without setting it to a new value?
Geek406
  • 21
  • 2
0
votes
1 answer

Grab just the GUID from powercfg /list

Working on a Caffinate Alternative for Windows and was wondering if there was a way I could grab just the GUID of the current used powerplan without the rest of the output heres a example of what I mean. What I am getting... when using powercfg…
zoeeechu
  • 11
  • 1