Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- color 02
- title WinFix by 191x7
- :: BatchGotAdmin
- :-------------------------------------
- REM --> Check for permissions
- IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
- >nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
- ) ELSE (
- >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
- )
- REM --> If error flag set, we do not have admin.
- if '%errorlevel%' NEQ '0' (
- echo Requesting administrative privileges...
- 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"
- "%temp%\getadmin.vbs"
- del "%temp%\getadmin.vbs"
- exit /B
- :gotAdmin
- pushd "%CD%"
- CD /D "%~dp0"
- :--------------------------------------
- for /F "tokens=2 delims=:" %%i in ('"ipconfig | findstr IP | findstr 192."') do SET LOCAL_IP=%%i
- echo.
- echo INFORMATION
- echo --------------------------------------
- echo.
- echo User name: %username%
- echo.
- echo Computer name: %computername%
- echo.
- echo IP adress: %LOCAL_IP%
- echo --------------------------------------
- echo.
- echo.
- echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- echo !! The batch script consists of 1 S.M.A.R.T. check and 4 procedures.
- echo !! The first procedure has one phase which checks the C partition using CHKDSK
- echo !! The second procedure checks and repairs the Windows Component Files in two phases
- echo !! The third procedure checks and repairs the Windows image in four phases
- echo !! The fourth procedure uses SFC to check and repair system files in one phase
- echo !! In Windows 7 only CHKDSK and SFC work, the rest is new (Windows 8+)
- echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- echo .
- echo ..
- echo ...
- echo -----------------------------------------------------
- echo Checking the S.M.A.R.T. status of the storage devices
- echo -----------------------------------------------------
- wmic diskdrive get status
- echo --------------------------------------------------
- echo OK = good. Bad or Caution = the storage is damaged
- echo --------------------------------------------------
- echo .
- echo ..
- echo ...
- @timeout /t 10
- echo ...
- echo ..
- echo .
- echo -------------------------------------------------
- echo Checking the Windows partition - procedure 1 of 4
- echo -------------------------------------------------
- chkdsk c: /scan
- echo -------------------------------------------------
- echo If it finds some problems, run chkdsk c: /f
- echo -------------------------------------------------
- echo .
- echo ..
- echo ...
- @timeout /t 10
- echo ...
- echo ..
- echo .
- echo ------------------------------------------------
- echo Windows component files check - procedure 2 of 4
- echo ------------------------------------------------
- Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
- echo --------------------------------------------------
- echo Phase 1 of 2 completed
- echo --------------------------------------------------
- Dism.exe /online /Cleanup-Image /SPSuperseded
- echo --------------------------------------------------
- echo Phase 2 of 2 completed
- echo .
- echo ..
- echo ...
- @timeout /t 10
- echo ...
- echo ..
- echo .
- echo --------------------------------------------------------------
- echo Checking the integrity of the Windows image - procedure 3 of 4
- echo --------------------------------------------------------------
- DISM /Online /Cleanup-Image /CheckHealth
- echo --------------------------------------------------
- echo Phase 1 of 3 completed
- echo --------------------------------------------------
- DISM /Online /Cleanup-Image /ScanHealth
- echo --------------------------------------------------
- echo Phase 2 of 3 completed
- echo --------------------------------------------------
- DISM /Online /Cleanup-Image /RestoreHealth
- echo --------------------------------------------------
- echo Phase 3 of 3 completed
- echo .
- echo ..
- echo ...
- @timeout /t 10
- echo ...
- echo ..
- echo .
- echo -------------------------------------------------
- echo Running System file check - procedure 4 of 4
- echo -------------------------------------------------
- sfc /scannow
- echo --------------------------------------------------------------------------------
- echo If SFC found some errors and could not repair, re-run the script after a reboot.
- echo --------------------------------------------------------------------------------
- echo -----------------------
- findstr /c:"[SR]" %windir%\logs\cbs\cbs.log >c:\sfcdetails.txt
- echo -----------------------
- echo Press [F] to pay respects
- pause >nul
Add Comment
Please, Sign In to add comment