Change the Windows power profile with a script
Another small post, but a solution to a problem which has annoyed me a lot.
Changing the power profile or power scheme in Windows is quite a hassle if you ask me. I have created a ‘High Performance’ profile on my laptop for when I’m doing development work on the machine and also have the ‘Balanced’ profile, which is the default in Windows. However, switching between these profiles is a lot of work (in my opinion).
I found out switching profiles can also be done with the powercfg
tool, via the command-line. To do so, you first need to know which profiles are configured on your system. You can do this by running the powercfg /L
command from the terminal.
The output will be something similar to the one below.
pwsh> powercfg /L
Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced) *
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
You can use these unique identifiers to switch between profiles. Run powercfg /S 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
to switch to the ‘High performance’ profile and powercfg /S 381b4222-f694-41f0-9685-ff5bb260df2e
to switch back to ‘Balanced’.
Remembering GUIDs isn’t very user-friendly either, so what can you do more? Well, creating shortcuts on the desktop or in the start menu!
You can even give them a nice icon. The default icons can be found in %SystemRoot%\System32\powercpl.dll
Switching between profiles is a breeze now. I’m using them on a daily basis and hope you will also find this lifehack useful.