Code: Select all
attrib -h -r -s %windir%\system32\catroot2
attrib -h -r -s %windir%\system32\catroot2\*.*
echo Stopping Windows Update related services...
echo ===========================================
echo.
net stop wuauserv
net stop CryptSvc
net stop BITS
echo Done!
echo.
echo Renaming Windows Update related folders...
echo ==========================================
echo.
ren %windir%\system32\catroot2 catroot2.old
ren %windir%\SoftwareDistribution sold.old
ren "%ALLUSERSPROFILE%\application data\Microsoft\Network\downloader" downloader.old
echo Done!
echo.
echo Starting Windows Update related services...
echo ===========================================
echo.
net Start BITS
net start CryptSvc
net start wuauserv
echo Done!
echo.
echo Task completed successfully...
echo.
dism.exe /online /cleanup-image /checkhealth
dism.exe /online /cleanup-image /scanhealth
dism.exe /online /cleanup-image /restorehealth
sfc /scannow
dism.exe /online /cleanup-image /AnalyzeComponentStore
dism.exe /online /cleanup-image /StartComponentCleanup
if not exist D:\$RECYCLE.BIN goto step2
echo y|chkdsk /f D:
:Step2
if not exist H:\$RECYCLE.BIN goto step3
echo y|chkdsk /f H:
:Step3
if not exist M:\$RECYCLE.BIN goto step4
echo y|chkdsk /f M:
:Step4
if not exist P:\$RECYCLE.BIN goto step5
echo y|chkdsk /f P:
:Step5
if not exist V:\$RECYCLE.BIN goto step6
echo y|chkdsk /f V:
:Step6
chkdsk.exe c:
if ERRORLEVEL 2 goto ADD_CHECK
echo.
echo The drive is okay this time.
goto end
:ADD_CHECK
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" /v BootExecute /t REG_MULTI_SZ /d "autocheck autochk /p \??\C:\0autocheck autochk *" /f
echo.
echo The C drive has problems Please run chkdsk next boot
pause
:end