计算机不遵守powercfg GUID命令行说明 [英] Computer not obeying powercfg GUID command line instructions
问题描述
我正在尝试编写一个脚本,以使用powercfg.exe和相关的GUID在睡眠/不执行任何操作之间切换盒盖动作.
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 5ca83367-6e45-459f-a27b-476b1d01c936 0
powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
什么也不做,
powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 1
powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 1
睡觉.
无论是手动输入还是作为.bat文件的一部分输入,结果都是相同的.我可以在ControlPanel> PowerOptions> ChangeWhatClosingTheLidDoes中看到设置更改,但是行为没有更改.
Whether I enter them manually or as part of a .bat file the result is the same. I can see the settings change in ControlPanel>PowerOptions>ChangeWhatClosingTheLidDoes but the behavior doesn't change.
如果您观看这段简短的视频,您将会明白我的意思,设置会发生变化,但行为不会发生变化;
If you look at this short video you will see what I mean, the setting changes, but not the behavior;
https://www.youtube.com/watch?v= N1yjiTMgnzk& feature = youtu.be
在视频中,我正在运行切换脚本,但是如果手动输入命令,结果是相同的.
In the video I am running toggle script I am trying to make, but the result is the same if I manually enter the commands.
我在Win7 x64上.
I'm on Win7 x64.
非常感谢您的帮助或建议.
Any help or suggestions would be greatly appreciated, thanks for reading.
推荐答案
设置更改后,您必须激活能源计划.执行以下命令:
You have to activate the energy plan after you set the changes. Execute the following command:
powercfg -setactive $GUID
其中$ GUID是更改后的能源计划的GUID(请使用powercfg -l
进行检查).因此,例如,当盖子关闭时,用于挂起的上部脚本必须为:
where $GUID is the guid of the changed energy plan (check it with powercfg -l
). So for example the upper script for suspending when the lid is closed would have to be:
powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 1
powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 1
powercfg -SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e
在此论坛中找到了解决方案,请参阅第9个帖子的编辑内容: http://www. autoitscript.com/forum/topic/85107-set-on-lid-close-power-option/?p=1173900
Found the solution in this forum, see the edit of the 9th post: http://www.autoitscript.com/forum/topic/85107-set-on-lid-close-power-option/?p=1173900
这篇关于计算机不遵守powercfg GUID命令行说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!