Scans and replaces any Microsoft Windows file on the computer
and replaces any changed file with the correct version. This is a
great command to run when you are running into an issue that is
difficult to troubleshoot.
Tested on Windows 8
SFC - system file checker tool
created by orpretsaM
PS: I'm the orpretsaM.
open notepad and paste this code, save as batch file
Name:
SFC-system_file_checker_tool-by_orpretsaM.bat
Code:
Code:
@ECHO OFF
mode 80,15
TITLE Check Privileges - By: orpretsaM
::checkPrivileges
::--------------------------------------------------------------------------
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' (
if '%~n0' == 'SFC-system_file_checker_tool-by_orpretsaM' (
GOTO:gotPrivileges
) ELSE (
setlocal DisableDelayedExpansion
set "batchPath=%~0"
set "batchDP=%~dp0"
set "batchName=SFC-system_file_checker_tool-by_orpretsaM"
setlocal EnableDelayedExpansion
(
ECHO Set UAC = CreateObject^("Shell.Application"^)
ECHO Set Fso = WScript.CreateObject^("Scripting.FileSystemObject"^)
ECHO Fso.MoveFile "!batchPath!", "!batchDP!!batchName!.bat"
ECHO UAC.ShellExecute "!batchDP!!batchName!.bat", "ELEV", "", "runas", 1
) > "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B
)
) ELSE (
if '%~n0' == 'SFC-system_file_checker_tool-by_orpretsaM' (
if '%1'=='ELEV' (shift & GOTO:gotPrivileges)
echo msgbox "Current permissions inadequate. Administrative permissions required. Run as administrator." ,0 + 16, "System File Checker Tool - By: orpretsaM" > "%temp%\checkPrivileges.vbs"
start /wait %temp%\checkPrivileges.vbs
del /F "%temp%\checkPrivileges.vbs"
CLS
for /l %%i in (100,-1,1) do (
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************
ECHO Invoking UAC in %%i%% &Ping -n 1 0.0.0.0>nul 2>&1
CLS
)
setlocal DisableDelayedExpansion
set "batchPath=%~0"
set "batchDP=%~dp0"
set "batchName=SFC-system_file_checker_tool-by_orpretsaM"
setlocal EnableDelayedExpansion
(
ECHO Set UAC = CreateObject^("Shell.Application"^)
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1
) > "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B
) else (
if '%1'=='ELEV' (shift & GOTO:gotPrivileges)
echo msgbox "Current permissions inadequate. Administrative permissions required. Run as administrator." ,0 + 16, "System File Checker Tool - By: orpretsaM" > "%temp%\checkPrivileges.vbs"
start /wait %temp%\checkPrivileges.vbs
del /F "%temp%\checkPrivileges.vbs"
CLS
for /l %%i in (100,-1,1) do (
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************
ECHO Invoking UAC in %%i%% &Ping -n 1 0.0.0.0>nul 2>&1
CLS
)
setlocal DisableDelayedExpansion
set "batchPath=%~0"
set "batchDP=%~dp0"
set "batchName=SFC-system_file_checker_tool-by_orpretsaM"
setlocal EnableDelayedExpansion
(
ECHO Set UAC = CreateObject^("Shell.Application"^)
ECHO Set Fso = WScript.CreateObject^("Scripting.FileSystemObject"^)
ECHO Fso.MoveFile "!batchPath!", "!batchDP!!batchName!.bat"
ECHO UAC.ShellExecute "!batchDP!!batchName!.bat", "ELEV", "", "runas", 1
) > "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B
))
GOTO:eof
:gotPrivileges
TITLE System File Checker Tool - By: orpretsaM
if exist '%temp%\OEgetPrivileges.vbs' (del /F '%temp%\OEgetPrivileges.vbs')
if exist '%temp%\ChangeName.vbs' (del /F '%temp%\ChangeName.vbs')
CLS
ECHO Options available:
ECHO.
ECHO 1. INFO
ECHO 2. Verify only
ECHO 3. Scan and repair
ECHO 4. Exit
ECHO.
CALL:info
:TOP
CLS
ECHO Options available:
ECHO.
ECHO 1. INFO
ECHO 2. Verify only
ECHO 3. Scan and repair
ECHO 4. Exit
ECHO.
SET /P TWK=Enter one option:
IF "%TWK%"=="4" exit
IF "%TWK%"=="3" goto SR
IF "%TWK%"=="2" goto VO
IF "%TWK%"=="1" CALL:info && GOTO:TOP
CLS
ECHO ERROR : Enter one available option
pause
GOTO:TOP
:VO
SFC /VERIFYONLY
PAUSE
GOTO:TOP
:SR
SFC /SCANNOW
PAUSE
GOTO:TOP
:info
echo msgbox "Scans and replaces any Microsoft Windows file on the computer and replaces any changed file with the correct version. This is a great command to run when you are running into an issue that is difficult to troubleshoot." ,0 + 64, "System File Checker Tool - By: orpretsaM" > "%temp%\info.vbs"
start /wait %temp%\info.vbs
del /F "%temp%\info.vbs"
GOTO:eof