lobstrosity
lobstrosity

Reputation: 37

Powercfg changes from cmd line not working

So I'm trying to get a bat file together with power settings that I want to apply. But I'm running into an issue. For some reason, the power button and lid close actions wont change. Here is the relevant code from the bat:

set pf=powercfg
set av=setacvalueindex
set pm=8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

rem lid close
%pf% /%av% %pm%    4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 003
rem power button
%pf% /%av% %pm%    4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 003
rem sleep button                                                        
%pf% /%av% %pm%    4f971e89-eebd-4455-a8de-9e59040e7347 96996bc0-ad50-47ec-923b-6f41874dd9eb 003

%pf% -setactive %pm%
pause    

And a bit of the relevant output from powercfg -query:

Subgroup GUID: 4f971e89-eebd-4455-a8de-9e59040e7347  (Power buttons and lid)
 GUID Alias: SUB_BUTTONS
  Power Setting GUID: 5ca83367-6e45-459f-a27b-476b1d01c936  (Lid close action)
    GUID Alias: LIDACTION
    Possible Setting Index: 000
    Possible Setting Friendly Name: Do nothing
    Possible Setting Index: 001
    Possible Setting Friendly Name: Sleep
    Possible Setting Index: 002
    Possible Setting Friendly Name: Hibernate
    Possible Setting Index: 003
    Possible Setting Friendly Name: Shut down
  Current AC Power Setting Index: 0x00000003
  Current DC Power Setting Index: 0x00000003   

As you can see, the lid close action is properly set now, as are the other two. However, when I go into control panel, it still says Sleep.

Anyone know what's going on?

Upvotes: 0

Views: 3302

Answers (1)

pstraton
pstraton

Reputation: 1120

This works for me, for the lid action, without reboot:

powercfg -setacvalueindex SCHEME_BALANCED SUB_BUTTONS LIDACTION 003

Upvotes: 0

Related Questions