创建批处理文件以切换控制面板设置 - "When I close the lid:"
Create a batch file to toggle control panel settings - "When I close the lid:"
当我将笔记本电脑 (Windows 10) 插入显示器时,我喜欢保持盖子关闭。我可以通过更改此 Q 底部快照中圈出的设置来做到这一点。当未插入显示器时,我更喜欢计算机在合上盖子时进入休眠状态。
有没有一种简单的方法可以通过批处理脚本更改这些设置?它不一定是一个开关;可以将一个脚本更改为 "Do Nothing",将一个脚本更改为 "Sleep".
这是一个未经测试的示例脚本供您尝试:
@"%__AppDir__%powercfg.exe" -SetDCValueIndex Scheme_Current 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 1
@"%__AppDir__%powercfg.exe" -SetACValueIndex Scheme_Current 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
@"%__AppDir__%powercfg.exe" -SetActive Scheme_Current
第一个命令将 current
电源配置 When I close the lid
和 On battery
设置为 Sleep
。第二行将current
电源配置When I close the lid
和Plugged in
设置为Do nothing
。第三行激活新设置。
[编辑/]
根据您对 GUID 的评论,我决定添加以下答案,改为使用它们的别名。 您可以通过在命令提示符下输入 "%__AppDir__%powercfg.exe" /Aliases
来找出这些别名及其各自的 GUID。
@"%__AppDir__%powercfg.exe" -SetDCValueIndex Scheme_Current Sub_Buttons LidAction 1
@"%__AppDir__%powercfg.exe" -SetACValueIndex Scheme_Current Sub_Buttons LidAction 0
@"%__AppDir__%powercfg.exe" -SetActive Scheme_Current
当我将笔记本电脑 (Windows 10) 插入显示器时,我喜欢保持盖子关闭。我可以通过更改此 Q 底部快照中圈出的设置来做到这一点。当未插入显示器时,我更喜欢计算机在合上盖子时进入休眠状态。
有没有一种简单的方法可以通过批处理脚本更改这些设置?它不一定是一个开关;可以将一个脚本更改为 "Do Nothing",将一个脚本更改为 "Sleep".
这是一个未经测试的示例脚本供您尝试:
@"%__AppDir__%powercfg.exe" -SetDCValueIndex Scheme_Current 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 1
@"%__AppDir__%powercfg.exe" -SetACValueIndex Scheme_Current 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
@"%__AppDir__%powercfg.exe" -SetActive Scheme_Current
第一个命令将 current
电源配置 When I close the lid
和 On battery
设置为 Sleep
。第二行将current
电源配置When I close the lid
和Plugged in
设置为Do nothing
。第三行激活新设置。
[编辑/]
根据您对 GUID 的评论,我决定添加以下答案,改为使用它们的别名。 您可以通过在命令提示符下输入 "%__AppDir__%powercfg.exe" /Aliases
来找出这些别名及其各自的 GUID。
@"%__AppDir__%powercfg.exe" -SetDCValueIndex Scheme_Current Sub_Buttons LidAction 1
@"%__AppDir__%powercfg.exe" -SetACValueIndex Scheme_Current Sub_Buttons LidAction 0
@"%__AppDir__%powercfg.exe" -SetActive Scheme_Current