Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :: Enable ANSI support for colors in the terminal
- cd /d "%~dp0"
- for /f %%a in ('forfiles /m "%~nx0" /c "cmd /c echo 0x1B"') do set "ESC=%%a"
- chcp 65001 > nul
- title Zensware CPU Idle State Toggle
- mode con: cols=70 lines=24
- :: Set colors for a refined GUI
- set "color_pink=%ESC%[35m"
- set "color_white=%ESC%[37m"
- set "color_reset=%ESC%[0m"
- set "color_green=%ESC%[32m"
- set "color_yellow=%ESC%[33m"
- set "color_cyan=%ESC%[36m"
- :menu
- cls
- echo %color_pink%
- echo %ESC%[1m███████╗███████╗███╗░░██╗░██████╗░██╗░░░░░░░██╗░█████╗░██████╗░███████╗%color_reset%
- echo %color_pink%╚════██║██╔════╝████╗░██║██╔════╝░██║░░██╗░░██║██╔══██╗██╔══██╗██╔════╝%color_reset%
- echo %color_pink%░░███╔═╝█████╗░░██╔██╗██║╚█████╗░░╚██╗████╗██╔╝███████║██████╔╝█████╗░░%color_reset%
- echo %color_pink%██╔══╝░░██╔══╝░░██║╚████║░╚═══██╗░░████╔═████║░██╔══██║██╔══██╗██╔══╝░░%color_reset%
- echo %color_pink%███████╗███████╗██║░╚███║██████╔╝░░╚██╔╝░╚██╔╝░██║░░██║██║░░██║███████╗%color_reset%
- echo %color_pink%╚══════╝╚══════╝╚═╝░░╚══╝╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░░╚═╝╚═╝░░╚═╝╚══════╝%color_reset%
- echo %color_white%
- echo %color_white%Options:%color_reset%
- echo.
- echo 1. Disable Idle States
- echo 2. Restore Default Idle State
- echo 3. Exit
- echo.
- echo.
- :: Check if hyper-threading/SMT is enabled
- powershell -NonI -NoP -C "Get-CimInstance Win32_Processor | Foreach-Object { if ([int]$_.NumberOfLogicalProcessors -gt [int]$_.NumberOfCores) { exit 262 } }"
- if "%errorlevel%"=="262" goto :hyperThreadingWarning
- set /p choice="Option: "
- if "%choice%"=="1" goto disable_idle
- if "%choice%"=="2" goto restore_default
- if "%choice%"=="3" exit
- goto menu
- :disable_idle
- cls
- echo %color_yellow%Disabling CPU Idle States (Full Performance Mode)...%color_reset%
- powercfg /setacvalueindex scheme_current sub_processor 5d76a2ca-e8c0-402f-a133-2158492d58ad 1
- powercfg /setactive scheme_current
- echo %color_yellow%CPU idle states have been disabled. CPU will now run at full performance.%color_reset%
- pause
- goto menu
- :restore_default
- cls
- echo %color_cyan%Restoring Default Idle State...%color_reset%
- powercfg /setacvalueindex scheme_current sub_processor 5d76a2ca-e8c0-402f-a133-2158492d58ad 0
- powercfg /setactive scheme_current
- echo %color_cyan%Default CPU idle state has been restored.%color_reset%
- pause
- goto menu
- :hyperThreadingWarning
- cls
- echo %color_green%
- echo Hyper-Threading/SMT Detected
- echo ──────────────────────────────────────────
- echo %color_yellow% Warning:%color_reset% You %color_white%should not disable idle states %color_reset%when
- echo this feature is enabled as it can cause
- echo worse overall CPU performance.
- echo.
- echo You may disable Hyper-Threading/SMT in the BIOS
- echo or consider disabling C-states instead.
- echo.
- echo %color_white%Press any key to exit...%color_reset%
- pause > nul
- exit /b 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement