Questions tagged [powercfg]

Windows commands that controls power settings.

Documentation:

46 questions
4
votes
1 answer

Why is the output of the "powercfg" command different in my program than when run in powershell

I'm trying to create a program to check if there is a process that will prevent my display from going to sleep. I've been doing this manually by running powercfg /requests and I want to run this command on a timer using .NET Problem is that the…
VladNeacsu
  • 1,268
  • 16
  • 33
3
votes
2 answers

How to open Power Options > System Settings with cmd / Powershell, or other

After looking over the Internet for days now, I have no other choices that ask you my question. How can I open, with cmd / run / powershell (or whatever) the followong control panel: Choose what closing the lid does I know how to enter powercfg.cpl…
31290
  • 45
  • 1
  • 10
2
votes
1 answer

Windows Registry settings corresponding to PowerCfg.exe /setacvalueindex

In my powershell script, I use powercfg /setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 238c9fa8-0aad-41ed-83f4-97be242c8f20 29f6c1db-86da-48c5-9fdb-f2b67b1f44da 0 I wanted to later verify if the above value has been set or not. How do i…
codeLover
  • 3,720
  • 10
  • 65
  • 121
2
votes
3 answers

How can run functions of powercfg by C# code?

how can run functions of powercfg by c# code? for example I want to run this, for Set turn off the display: never powercfg -CHANGE -monitor -timeout -ac 0
sari k
  • 2,051
  • 6
  • 28
  • 34
2
votes
2 answers

How to start `powercfg.exe -energy` from a .NET app?

When I using (var process = new Process { StartInfo = new ProcessStartInfo { FileName = "powercfg.exe", Arguments = "-energy", RedirectStandardOutput = true, UseShellExecute = false, } }) { …
Jader Dias
  • 88,211
  • 155
  • 421
  • 625
2
votes
1 answer

How do I read individual PowerCfg settings?

If I run this command: powercfg -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c ...I can subsequently run this command: powercfg -GETACTIVESCHEME ...and it will tell me what I did. (It will output 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c.) Similarly,…
soapergem
  • 9,263
  • 18
  • 96
  • 152
2
votes
1 answer

Computer not obeying powercfg GUID command line instructions

I am trying to write a script to toggle the lid action between sleep/do nothing by using powercfg.exe and the relevant GUID. powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347…
user3133275
  • 41
  • 1
  • 8
2
votes
2 answers

Calling powercfg /requests from c# gives wrong values

So I have a chunk of code to call powercfg with the /requests option and get the result back from stdout. Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName =…
Eva No Gainen
  • 65
  • 1
  • 6
2
votes
1 answer

How to run functions of Windows powercfg with Python code?

Trying to use Python for more than text parsing and figure the best way is to write a script I will find useful. I'm having an issue though I get an error when making the call. from subprocess import call call (["powercfg", "/batteryreport"]) The…
Tyler Mills
  • 353
  • 1
  • 3
  • 15
1
vote
1 answer

There is a delayed shutdown function in windows shutdown -s -t , but is there a delayed switching-on?

For example, is there a command that allows you to turn on the computer (be it a remote computer connected to the network or your own), for example, after a reboot, after a specified, strictly defined, period of time? Is there a reverse command…
Das Alias
  • 11
  • 1
1
vote
0 answers

How can I run a cron job only when my laptop is active [WSL]?

I have a small script (on WSL / Debian) to rsync my files to my Debian server. I've set the script to run every two hours. My laptop is a Windows 10 machine. When put to sleep / idle, the laptop goes into a Modern Standby state: When Modern…
NoExpert
  • 376
  • 1
  • 2
  • 11
1
vote
1 answer

Error when trying to run powercfg /srumutil through C# Process.Start()

I am trying to run the command powercfg /srumutil /output C:\\EnergyConsumption\\srumutil.csv /csv through a C# application. The command above runs successfully in powershell and cmd but it returns the following error when executed through my C#…
JimS
  • 349
  • 1
  • 4
  • 19
1
vote
1 answer

CMD Powercfg command fails when launched from HTA VBScript

I have the following HTA file: test
1
vote
0 answers

Backing up and restoring power plan with C#

I making a program that messes around with the Windows power plan. Before making any changes it would be wise to make a copy of the current power plan, so the user can restore it. There is a command prompt command powercfg –restoredefaultschemes but…
New Coder
  • 45
  • 1
  • 5
1
vote
0 answers

Powershell: How to add a loop code inside an ApplicationContext loop and how to exit gracefully?

Could someone have a look and help me out with two questions I have? Is this the correct way to exit the application? (see towards the end of the code) # Add assemblies Add-Type -AssemblyName System.Windows.Forms,System.Drawing # Create a…
lucullus
  • 187
  • 1
  • 11
1
2 3 4