Skip to content

Instantly share code, notes, and snippets.

@SkyN9ne
Last active March 15, 2025 03:02
Show Gist options
  • Save SkyN9ne/1b7ff0da644cc4705e43207c116a4ac0 to your computer and use it in GitHub Desktop.
Save SkyN9ne/1b7ff0da644cc4705e43207c116a4ac0 to your computer and use it in GitHub Desktop.
Quick Windows System Utilities including SFC / DISM / ChkDsk
@echo OFF
COLOR 0A
TITLE Quick System Utils
REM Checking for admin privileges
>NUL 2>&1 "%SYSTEMROOT%\System32\cacls.exe" "%SYSTEMROOT%\System32\config\system"
REM If the error flag is set, we do not have admin privileges (yet...)
IF '%ERRORLEVEL%' NEQ '0' (
echo Requesting a UAC Prompt to get Admin
goto UACPrompt
) ELSE ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%TEMP%\getadmin.vbs"
SET params = %*:"="
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%TEMP%\getadmin.vbs"
REM You could run this easier with WinKey + R (aka Run)
REM or cd into the %TEMP% and run it manually
"%TEMP%\getadmin.vbs"
DEL /s /q "%TEMP%\getadmin.vbs"
EXIT /B
:gotAdmin
COLOR 0A
TITLE Quick System Utils
WHOAMI
TIMEOUT /T 2 /NOBREAK
WHOAMI /PRIV
goto Menu
:Menu
cls
echo Welcome to the utilities. Please choose an option by it's number.
echo 1. Shutdown timer
echo 2. Power settings
echo 3. Error checking
echo 4. Quit
SET /p choice=Enter number of chosen option:
IF %choice% EQU 1 goto ShutdownTimer
IF %choice% EQU 2 goto PowerSettings
IF %choice% EQU 3 goto Stability
IF %choice% EQU 4 goto Quit
:ShutdownTimer
cls
echo To abort press ALT + F4
SET /p shutdowntime=Specify seconds until shutting down
SHUTDOWN /s /t %shutdowntime%
IF '%ERRORLEVEL%' NEQ '0' (
echo An exception occured
TIMEOUT /t 3 /NOBREAK
goto Menu
) ELSE (
echo Shutdown timer has been initiated.
TIMEOUT /t 3 >NUL
exit /B
)
:Stability
cls
echo To quit press ALT + F4
echo 1. System scan + check
echo 2. C: drive repair
echo 3. System scanner troubleshooter
echo 4. All-In-One
SET /p check=Choose an option number
IF %check% EQU 1 cls && sfc /SCANNOW
IF %check% EQU 2 cls && chkdsk /f C:
IF %check% EQU 3 cls && DISM /Online /Cleanup-Image /RestoreHealth
IF %check% EQU 4 cls && sfc /SCANNOW && chkdsk /f C: && DISM /Online /Cleanup-Image /RestoreHealth
echo Operation completed successfully!
TIMEOUT /t 5 /NOBREAK
EXIT /B
:PowerSettings
cls
echo Please choose an option or quit with ALT + F4
echo 1. Low
echo 2. High
echo 3. Efficiency report (laptops only)
SET /p profile=Please enter a number
IF %profile% EQU 1 powercfg /setactive f9553277-119f-498d-9338-8fe1d4b1346a && echo The low profile setting has been configured.
IF %profile% EQU 2 powercfg /setactive e9a42b02-d5df-448d-aa00-03f14749eb61 && echo The high profile setting has been configured.
IF %profile% EQU 3 powercfg /energy
echo Done...
TIMEOUT /t 3 /NOBREAK >NUL
pause
:Quit
EXIT /B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment