如何读取单个PowerCfg设置? [英] How do I read individual PowerCfg settings?

查看:263
本文介绍了如何读取单个PowerCfg设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我运行此命令:

powercfg -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

...我可以随后运行此命令:

...I can subsequently run this command:

powercfg -GETACTIVESCHEME

...它会告诉我没有。 (它将输出8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c。)

...and it will tell me what I did. (It will output 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c.)

同样,如果我运行这个命令:

Similarly, if I run this command:

powercfg -change -monitor-timeout-dc 0

我想知道如何可以查询。是否有一些powercfg标志,我可以读取 monitor-timeout-dc 的当前值和其他设置?

I want to know how I can query that. Is there some powercfg flag where I can read the current value of monitor-timeout-dc, and other settings like that?

推荐答案

这将返回关闭的监视器超时(以秒为单位)。注意,我跳过16行DC超时,如果你想AC超时,然后跳过15行。

This returns the monitor timeout (in seconds) to turn off. Note that i'm skiping 16 lines for DC timeout, if you want AC timeout then skip 15 lines.

@echo off
setlocal enabledelayedexpansion

set SCHEME=8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
set VIDEO_GUID=7516b95f-f776-4464-8c53-06167f40cc99

for /f "skip=16 tokens=1*" %%a in ('powercfg -Q !SCHEME! !VIDEO_GUID!') do (
for /f "tokens=2 delims=:" %%c in ('echo/%%a%%b') do (
set /a "timeout=%%c"&goto break))
:break
echo/%timeout%
pause>nul

您可以查询任何配置。对于方案列表,使用 powercfg -list ,使用 powercfg -aliases

You can query any configuration. For a list of schemes use powercfg -list, for a list of guids use powercfg -aliases

这篇关于如何读取单个PowerCfg设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆