通过命令行关闭节电选项

Nic*_*ick 12 energysmart power-saving windows-vista

在Windows XP上,脚本中的以下命令将阻止在PC上启用任何省电选项(监视器睡眠,HD睡眠等).这对于自助服务终端应用程序非常有用.

powercfg.exe /setactive presentation
Run Code Online (Sandbox Code Playgroud)

Vista上的等价物是什么?

Nic*_*ick 9

将值设置为永远不能通过将值传递0-change选项来完成,即:

powercfg.exe -change -monitor-timeout-ac 0
Run Code Online (Sandbox Code Playgroud)

表示监视器超时将设置为"从不".因此,演示计划可以通过以下方式实现:

powercfg.exe -change -monitor-timeout-ac 0
powercfg.exe -change -disk-timeout-ac 0
powercfg.exe -change -standby-timeout-ac 0
powercfg.exe -change -hibernate-timeout-ac 0
Run Code Online (Sandbox Code Playgroud)


小智 4

powercfg.exe 在 Vista 中的工作方式略有不同,默认情况下不包含“演示”配置文件(至少在我的计算机上)。因此您可以设置“演示”配置文件,然后使用以下命令获取 GUID

powercfg.exe -list
Run Code Online (Sandbox Code Playgroud)

以及将其设置为该 GUID 的以下内容:

powercfg.exe -setactive GUID
Run Code Online (Sandbox Code Playgroud)

或者,您可以将 powercfg.exe 与 -change 或 -X 一起使用来更改当前电源方案的特定参数。

来自“powercfg.exe /?”的片段:

-CHANGE、-X 修改当前电源方案中的设置值。

          Usage: POWERCFG -X <SETTING> <VALUE>

          <SETTING>   Specifies one of the following options:
                      -monitor-timeout-ac <minutes>
                      -monitor-timeout-dc <minutes>
                      -disk-timeout-ac <minutes>
                      -disk-timeout-dc <minutes>
                      -standby-timeout-ac <minutes>
                      -standby-timeout-dc <minutes>
                      -hibernate-timeout-ac <minutes>
                      -hibernate-timeout-dc <minutes>

          Example:
              POWERCFG -Change -monitor-timeout-ac 5

          This would set the monitor idle timeout value to 5 minutes
          when on AC power.
Run Code Online (Sandbox Code Playgroud)