На Windows 2003, как я могу получить схему активного питания с помощью powercfg?

1001
Ogrish Man

В Windows 7 я могу использовать параметр, getactiveschemeчтобы получить эту информацию. Как я могу получить это на Windows 2003?

В Windows 7 я могу запустить следующий код:

PS C:\Users\e> powercfg -getactivescheme Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance) 

В Windows 2003 я получаю сообщение об ошибке:

PS G:\> powercfg -getactivescheme Invalid Parameters -- try "/?" for help PS G:\> 

Кто-нибудь может помочь? Благодарю.

1
Смотрите здесь: http://ss64.com/nt/powercfg-xp.html David Ruhmann 11 лет назад 0

1 ответ на вопрос

2
nixda

This is a quote from Microsoft

/query, /q
Use the following command to query each scheme to find out the settings: powercfg /query scheme For example, if you run powercfg /query "always on", the settings for the Always On scheme appear. [...]

If you do not specify a particular scheme, the default scheme settings appear. For example, if you run powercfg /query, the settings of the current scheme appear. The current scheme is listed in the Power Options tool in Control Panel.

In Windows 7 Powercfg -query displays the name and GUID of your active scheme in the first line. Maybe the strategie for Windows 2003 would be similar. The following example shows you how to extract the scheme name with windows batch commands. Of course you can convert this example to powershell.

@echo off powercfg -query > list.txt set /p line=< list.txt for /F "tokens=2 delims=()" %%a in ("%line%") do set string=%%a echo %string% del list.txt pause 

How it works

  • Pipe the output of powercfg -query to a temp text file
  • Read back only the first line of the temp file
  • strip out everything between ( and )
  • display the scheme name with echo
  • delete the temp file
Да, это не работает. Это просто показывает некоторые конфигурации активной схемы, но без имени схемы. Ogrish Man 11 лет назад 0
PS G: \> powercfg / query Поле Описание Значение ----------------- ----- Имя Всегда включено Числовой идентификатор 3 Отключить монитор (AC) Не поддерживается Отключить монитор (DC) не поддерживается Отключение жестких дисков (AC) Не поддерживается Отключение жестких дисков (DC) Не поддерживается Системный режим ожидания (AC) Не поддерживается Системный режим ожидания (DC) Не поддерживается Системный спящий режим (AC) Не поддерживается Системный спящий режим (DC) Не поддерживается Поддерживаемый дроссель процессора (AC) не поддерживается Дроссель процессора (DC) не поддерживается PS G: \> Ogrish Man 11 лет назад 0
В Windows 2003 кажется, что это 4-я строка, содержащая название схемы. В Windows 7 это первая строка. Вы должны настроить пример. nixda 11 лет назад 0