Updated September 26, 2024
I was thinking the other day about what program I use the most when doing computer repair. The one program I use the most on Windows computers would have to be System File Checker (SFC). SFC checks for system files that may have gotten corrupted or replaced with incorrect versions. Here's how to check Windows 10 system files with System File Checker.
SFC has been included inside Windows since Windows XP and is a CLI (Command-Line Interpreter) program, meaning you must use an Administrative Command Prompt / PowerShell to run it.
Open a Command Prompt with Administrator privileges in Windows 10
- Left-click on the Start button.
- Scroll down the program list and then left-click on the Windows System folder to expand.
- Right-click on Command Prompt.
- On the context menu that appears, hover your cursor over More and then left-click on Run as administrator. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
Open PowerShell with Administrator privileges in Windows 10
- Right-click on the Start button to bring up the Power User menu.
- Left-click on Windows PowerShell (Admin). If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
When you have an Admin Command Prompt or PowerShell open, you must type SFC and a combination of syntax and switch(s). The most commonly used syntax/switch is SFC /scannow. Here is a complete list of syntax/switches for SFC.
SFC [/SCANNOW] [/VERIFYONLY] [/SCANFILE=<file>] [/VERIFYFILE=<file>] [/OFFWINDIR=<offline windows directory> /OFFBOOTDIR=<offline boot directory>]
/SCANNOW (Scans integrity of all protected system files and repairs files with problems when possible)
/VERIFYONLY (Scans integrity of all protected system files. No repair operation is performed)
/SCANFILE (Scans integrity of the referenced file, repairs file if problems are identified. Specify full path <file>)
/VERIFYFILE (Verifies the file's intergrity with full path <file>. No repair operation is performed)
/OFFBOOTDIR (For offline repair specify the location of the offline boot directory)
/OFFWINDIR (For offline repair specify the location of the offline Windows directory)
Examples
sfc /scannow
sfc /verifyfile=c:\windows\filetobereplaced.dll
sfc /scanfile=d:\windows\filetobereplaced.dll /offbootdir=d:\ /offwindir=d:\windows
sfc /verifyonly
Once SFC is done scanning the system files, it will give one of four possible results:
- Windows Resource Protection did not find any integrity violations.
All system files are fine, and you're good to go.
- Windows Resource Protection could not perform the requested operation.
There may be another program preventing SFC from running. In this case, boot the system into safe mode and run SFC from there.
- Windows Resource Protection found corrupt files and successfully repaired them.
All system files are now correct, and you're ready to go. If you want to view the repair details, see below.
- Windows Resource Protection found corrupt files but was unable to fix some of them.
If you get this message, SFC found a file or files it couldn't repair. The next thing you will need to do is find the name of the file(s). Using the Find String utility, you can filter out the SFC results with only the scanned components and create a text file with that information on your Desktop called sfcdetails.txt. Just copy the following code into an Administrative Command Prompt (it will not run using PowerShell) and press Enter.
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"
Manually replacing a corrupt system file in Windows 10
Note: To replace a corrupt system file, you must have a known good copy of the file(s) in question. Another computer or virtual machine running Windows 10 is a good source for files. Since I do computer repair for a living, I have all Windows versions that are still supported by Microsoft running inside of Oracle VirtualBoxes.
The first thing to do is note the location (path) and name of the file(s) that must be replaced from the sfcdetails.txt file. Once you have another copy of the corrupt file(s), you will need to take administrative ownership of the file(s). To do this, modify the following command with the path\filename of the file you want to replace and then type it into an Administrative Command Prompt:
takeown /f path\filename
Example: takeown /f C:\Windows\FileToBeReplaced.dll
Next, you will have to grant administrators full access to the file(s) being replaced. To do this, modify the following command with the path\filename of the file you want to replace and then type it into an Administrative Command Prompt:
icacls path\filename /grant administrators:F
Example: icacls C:\Windows\FileToBeReplaced.dll /grant administrators:F
The third thing to do is copy over the new file(s) and replace the corrupt one(s).To do this, modify the following command with the path\filename of the file you want to replace and then type it into an Administrative Command Prompt:
copy path\filename path\filename
Example: copy C:\Temp\FileToBeReplaced.dll C:\Windows\FileToBeReplaced.dll
9dce3ed5-f4bd-4a23-b404-6e79d7d5bfa0|1|5.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04