Skip to content

Instantly share code, notes, and snippets.

@mastervash
Last active October 22, 2024 15:31
Show Gist options
  • Save mastervash/98a0adc2d627f0eac19f42828087a5c4 to your computer and use it in GitHub Desktop.
Save mastervash/98a0adc2d627f0eac19f42828087a5c4 to your computer and use it in GitHub Desktop.
Batch file to taggle between any 2 Windows Power Plans
@echo off
:: Get the GUIDs for High performance and Power saver plans
for /f "tokens=3 delims= " %%A in ('powercfg /list ^| findstr /i "high performance"') do set performance_guid=%%A
for /f "tokens=3 delims= " %%A in ('powercfg /list ^| findstr /i "power saver"') do set efficient_guid=%%A
:: Get the current active power scheme
for /f "tokens=3 delims= " %%G in ('powercfg /getactivescheme') do set current=%%G
:: Display current plan
echo Current Power Plan GUID: %current%
:: Toggle between High Performance and Power Saver plans
if "%current%" == "%performance_guid%" (
echo Switching to Power Saver mode...
powercfg /s %efficient_guid%
) else (
echo Switching to High Performance mode...
powercfg /s %performance_guid%
)
:: Pause to allow time to read the output
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment