0

所以我正在尝试获取一个 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    

以及 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   

如您所见,现在盖子关闭动作已正确设置,其他两个也是如此。但是,当我进入控制面板时,它仍然显示睡眠。

有谁知道发生了什么?

4

1 回答 1

0

这对我有用,对于盖子动作,无需重新启动:

powercfg -setacvalueindex SCHEME_BALANCED SUB_BUTTONS LIDACTION 003
于 2016-10-21T20:27:47.230 回答