How do I change the power plan using batch

10,537

Solution 1

I found this.

@echo off
powercfg -s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
pause

Solution 2

for auto closing of the CMD window, just make a BAT file with powercfg -s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c in it only. It will auto close, don't need echo off or Pause commands in there.

Solution 3

As an alternative to the other answers on this page you could use the aliases, which is a bit more readable. here is a description of the powercfg command. When run with the aliases option, it will show all active aliases. The aliases for the default plans are:

scheme_max, power saver
scheme_min, high performance
scheme_balanced, balanced

So then you would use it as such: powercfg -setactive scheme_min

Solution 4

The currently selected power plan can be set using the powercfg command, which can be included in any .bat/.cmd/.ps1 file where you might need to do so. For example:

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

GUID 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c corresponds to the High Performance scheme.

To find the correct GUID for the power plan you want to select, you can use the -list option, e.g.:

C:\WINDOWS\system32>powercfg -list

Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 110782a4-72aa-47dd-bec2-293ec84ce5b7  (Keep Screen On)
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e  (Balanced) *
Power Scheme GUID: 3aaca180-95bf-47c2-b285-8ecb240364e8  (Never Sleep)

This will show you all custom plans. A built-in plan is shown only if it's the plan currently selected. For built-in plans, you can look at the plan aliases. The powercfg command defines aliases for the GUIDs that can be specified as an argument in place of a GUID. E.g.:

C:\WINDOWS\system32>powercfg -s scheme_min

You can find out what these aliases are with the -alias option, e.g.:

C:\WINDOWS\system32>powercfg -aliases

a1841308-3541-4fab-bc81-f71556f20b4a  SCHEME_MAX
8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  SCHEME_MIN
381b4222-f694-41f0-9685-ff5bb260df2e  SCHEME_BALANCED
e73a048d-bf27-4f12-9731-8b2076e8891f  SUB_BATTERY
637ea02f-bbcb-4015-8e2c-a1c7b9c0b546    BATACTIONCRIT
d8742dcb-3e6a-4b3c-b3fe-374623cdcf06    BATACTIONLOW
5dbb7c9f-38e9-40d2-9749-4f8a0e9f640f    BATFLAGSCRIT
.
.
.
3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e    VIDEOIDLE

The SCHEME_... aliases correspond to the power plans (the other aliases correspond to other values that might be passed as arguments to other powercfg command invocations).

NOTE: as noted earlier, the GUID values available via alias are not necessarily the same shown in the -list option. The -list GUIDs shown will be only any user-defined schemes, plus the currently-active scheme if that scheme is one of the Windows default/built-in schemes. Inactive built-in schemes are not shown (presumably to simplify the output).

On the other hand, -aliases shows all defined aliases for the powercfg command, which are only defined for the built-in schemes. There won't be any aliases for user-defined schemes.

For now, this shouldn't be a problem as all of the built-in plans have aliases and so will show up when using the -aliases option. But if Microsoft ever adds a built-in plan for which they don't define an alias, you can learn the GUID simply by selecting that plan and then using the -list option.

Finally note that the alias names relate to the aggressiveness of power saving, not the computer performance. I.e. the SCHEME_MIN alias is the one that corresponds to the High Performance scheme, while SCHEME_MAX corresponds to Power Saver.

(I realize this answer may seem to reiterate information from some of the other answers. And it does. But none of the answers are comprehensive, and it is more useful to have a single answer that provides all of the information one might need. I tried to improve the accepted answer by editing it, but the Superuser community did not appreciate that and rejected the edit. So I am posting my own answer to provide that single comprehensive answer that the question deserves.)

Share:
10,537

Related videos on Youtube

09stephenb
Author by

09stephenb

Updated on September 18, 2022

Comments

  • 09stephenb
    09stephenb over 1 year

    I would like to know how to change the power plan in Windows 7 to high performance using a batch file. I am making a program that boosts pc performance.

  • Admin
    Admin over 10 years
    "381b4222-f694-41f0-9685-ff5bb260df2e" is balanced power plan. For high performance (as asked by the OP), "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c" should be used instead.
  • AminM
    AminM about 10 years
    how can we find out 'what is my power plan???
  • 09stephenb
    09stephenb about 10 years
    @Jeson Park you should put this in your own question.
  • AminM
    AminM about 10 years
    @09stephenb To determine the GUID for all existing power schemes, type Powercfg /List at the command prompt, and then press ENTER.
  • 09stephenb
    09stephenb about 10 years
    @Jeson Park just to clarify why are you telling me this.
  • AminM
    AminM about 10 years
    @09stephenb I did not tell you. i Wrote this for other User that read this Question!!
  • Firee
    Firee about 8 years
    a little help, the batch file works fine, but it opens the command prompt everytime the bat file runs, with the message "press any key to continue.." is there any way to auto-close the cmd window??
  • Copy Run Start
    Copy Run Start almost 8 years
    @Firee Just delete the pause from the script.
  • Ravindra Bawane
    Ravindra Bawane over 7 years
    Could you include an example of how OP might use the powercfg command and aliases to change his power plan to High Performance?
  • Berend
    Berend over 7 years
    @music2myear That was the example I already included, but I adjusted the markup to make it more clear.