System File Checker, along with Deployment Image Servicing and Management, is the default option in Windows to scan and repair corrupt system files.
If you encounter any system errors that may occur due to issues with system files or Dynamic Link Libraries (DLLs), you can run SFC to resolve the issues.
However, there are more than one ways to run SFC with different options. And you may need to run this utility when you can’t normally boot to your OS. In this article, we have provided detailed steps for all these scenarios.
How Does SFC Repair Corrupt System Files
Before Windows Vista, System File Checker would use the cached copy of the system files in a compressed folder inside the
%SystemRoot%\System32\dllcache directory for scanning and repairing corrupt system files.
Now, however, Microsoft integrated SFC inside the Windows Resource Protection (WRP) feature. This feature prevents outside sources from replacing the crucial built-in system files and registry data.
Whenever you run SFC, Windows Resource Protection performs the following operations to scan and repair the protected files:
- First, it checks whether the protected system files, especially DLL files, are in the correct location or not. It does so by comparing the files with the corresponding registry entries, usually the COMPONENTS registry hive.
- If it finds inconsistencies, it checks system files against the files inside
%WinDir%\WinSxS\Backupfolders (Windows Component Store).
- Most of the Windows files, especially inside System32, are hard-linked to the components inside the WinSxS folder. So, only the files inside the folder actually exist and the usual system files simply link to these components. WRP checks any broken hard links and repairs them.
- It does not check all the links but gets information from the registry on which links need examination.
- If it still can’t repair corrupt files, it accesses the file store on Microsoft’s website (you need to be connected to the internet for this) to look for and replace the files and re-creates the hard links.
- If you run SFC using a different Windows folder on the PC (if you have a multi-boot system), WRP also looks upon the other OS for replacing the system files.
- If WRP fails to resolve the issue, it gives the “Windows Resource Protection found corrupt files but was unable to fix some of them” error message.
- In some scenarios, the WRP becomes unable to scan the files or can’t run at all. In such cases, running SFC gives the “Windows Resource Protection Could Not Perform the Requested Operation” error message.
It also creates a log file,
%windir%\Logs\CBS\CBS.log, which includes the details of the process. You can check the log by entering the following command on Prompt to create a readable
.txt file from the log and then opening it:
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"
- If you get a “The system cannot find the path specified” error, you may have enabled syncing of the Desktop folder on OneDrive. So, you need to replace
"%userprofile%\OneDrive\Desktop\sfcdetails.txt"on the above command.
How to Run System File Checker to Repair Corrupt Files
There are mainly three scenarios where you need to run the System File Checker,
- Scan all system files and repair the corrupted ones.
- Scan and repair a specific system file.
- Scan and repair system files when you get stuck in the startup or can’t log in to an account.
SFC contains many parameters to aid in this process, which are:
|Scans and repairs all protected system files.|
|Scans all protected system files for integrity issues, but doesn’t repair.|
|Scans and repairs a particular protected system file.|
|Scans a particular system file for integrity issues but doesn’t repair it.|
|Sets the offline windows directory for offline SFC scan.|
|Sets the offline boot directory for offline SFC scan.|
|Displays the parameters and functions for SFC.|
Now, let’s move on to the detailed steps for each task.
Running System File Checker on All System Files
The most common use of the System File Checker is to scan and repair all the protected system files at once. Here’s how you can do so:
- Open Run by pressing Win + R.
cmdand press Ctrl + Shift + Enter to open the Elevated Command Prompt.
sfc /verifyonlyto scan all protected system files but without performing any repairs.
- If it shows errors, run the following command:
This command scans and repairs all protected system files. The reason to run
sfc /verifyonly even though
sfc /scannow also scans the files, is because the latter takes longer. So, unless there’s a need to you don’t need to run it.
We recommend running the Deployment Image Servicing and Management (DISM) tool first before SFC. This is because this utility also repairs the files on the WinSxS folder if there are any issues. The command is
dism /online /cleanup-image /restorehealth
Running System File Checker on a Particular System File
You can also run SFC for a particular file. However, it must be a protected system file, otherwise, SFC will fail.
Here are the steps to scan and repair a particular system file:
- Open the Elevated Command Prompt.
sfc /verifyfile=<file>to scan a specific protected file without performing any repairs. You need to include the full path of the file, such as:
- To scan and repair the file at the same time, enter the command
Like with the previous case, you can run the DISM tool beforehand to increase the success of the SFC command.
Running System File Checker in Safe Mode
If you can’t log in to your account due to system issues, you can try running SFC in safe mode. Here’s how you can do so:
- Force shutdown your PC three times in a row and reboot again each time. After the third reboot, click on Advanced Options.
- Go to Troubleshoot > Advanced options > Startup Settings > Restart.
- After reboot, Press F5 or 5 once you see the startup options.
- Then, log in to your account after you get to the login screen and perform the methods we mentioned earlier to run System File Checker.
Running Offline System File Checker
If you can’t even boot in safe mode, the only option you have, if you get stuck in startup, is to run the offline SFC scan. You need need to access the Advanced Startup to do so.
While you can use your own Operating System to access this environment, we recommend using an installation or recovery disk to increase your success.
Here are the necessary steps to run the offline SFC:
- Create a Windows Installation or Recovery Media. Make sure it is the same version and edition as the Windows on your PC.
- Boot using this media. You may need to change the boot order.
- Set your language preferences and click Next.
- If you see the license agreements, check I accept the license terms and click Next.
- Select Repair your Computer on the Install screen.
- Go to Troubleshoot > Advanced options > Command Prompt.
bcdeditand press Enter.
- Scroll to Windows Boot Loader and note the following values:
sfc /scannow /offbootdir=<drive letter in device> /offwindir=<drive letter in osdevice>\systemroot
sfc /scannow /offbootdir=C:\ /offwindir=C:\Windows
- The device and osdevice drive letter may be different in some cases, so look out for those. They also may not be the same as the drive letter of the system during normal Windows boot.