How to use SFC to repair missing or corrupt Windows files in CMD

When you have problems with your computer, Windows system files may become corrupted or go missing. This might be caused by sudden power drops, hardware malfunctions, a hard disk or solid-state drive approaching its end of life, and so on. If Windows reports that it can’t start because some of its files are corrupted or missing, you should use the System File Checker (SFC) tool in the Command Prompt. You should do the same when Windows starts to blue screen on you with weird corruption related errors. SFC scans all the Windows system files on your computer, identifies those that are corrupt or missing, and tries to fix the problems it finds. Here's how to use it:

NOTE: This tutorial applies to both Windows 10 and Windows 11, and it also works for older Microsoft operating systems such as Windows 7.

1. How to use SFC in CMD to repair missing or corrupted system files when Windows can’t boot

If Windows doesn't load because of missing or corrupt system files, you’ll have to launch Command Prompt before the boot process. So, first, do that by following any of the methods in this tutorial: How to open Command Prompt when Windows doesn't boot (3 ways).

Then, once the Command Prompt is up and running, use the SFC command with the following three additional parameters:

  • /scannow - checks the integrity of all protected system files and attempts to repair them when possible.
  • /offbootdir - specifies the drive or partition that contains the system files required for booting Windows; in most cases, this would be the C: drive.
  • /offwindir - designates the location of the Windows directory, which, in most situations, is the C:\Windows folder.

So, if your computer or device uses a standard Windows installation, you will need to run this command:

sfc /scannow /offbootdir=C:\ /offwindir=C:\Windows\

… and then press Enter on your keyboard.

Running the SFC command before Windows boot

What you’re basically telling Windows to do when you run the SFC command with the parameters we’ve shown you is: scan the Windows folder located on the boot partition C: and fix any missing or corrupt system files encountered. Unless you’re using a fast SSD as your boot drive, now would be a good time for you to arm yourself with some patience. That’s because running the SFC command will take quite a bit of time.

Scanning and repairing missing or corrupt system files

When the process finishes, you are notified whether issues have been found and resolved or not. For example, if everything is fine with your system files, you will receive a message saying that “Windows Resource Protection did not find any integrity violations.” Or, if problems were found and repaired, System File Checker will tell you that “Windows Resource Protection found corrupt files and successfully repaired them.”

The system file check finished and no broken files were found

If there are problematic files that can’t be fixed, they are always mentioned in a log file named CBS.log. This file is found in the Windows folder at this exact location:

C:\Windows\Logs\CBS\CBS.log

Skip to the last chapter in this guide to see how to identify the corrupt or missing files that couldn’t be repaired.

2. How to use SFC in CMD to repair missing or corrupted system files when Windows can boot

You may also find yourself in a scenario where Windows loads successfully, but it crashes randomly with a Blue Screen of Death (BSOD) mentioning corruption errors. If this is the situation you’re in, start the Command Prompt as an administrator.

Then, in the CMD window, type this command:

sfc /scannow

… and press Enter.

The /scannow parameter forces the SFC tool to check the integrity of all system files and attempt to repair any broken or missing files, if possible.

Running SFC in Command Prompt

Again, unless you have a fast SSD in your computer, arm yourself with some patience. The SFC tool can take a long time to run (at least a couple of minutes). When it's done, you’ll see a Verification 100% complete message in the Command Prompt window. If any problems were found during the scan, you are also informed. In our case, SFC found a couple of corrupt files but was able to fix them all.

System File Checker found corrupt system files

System File Checker logs any broken files that can’t be fixed in a file called CBS.log. You’ll find it at this path on your Windows PC:

C:\Windows\Logs\CBS\CBS.log

Read the next section of this guide to see how to identify the system files that couldn’t be repaired.

How to analyze the SFC log file (CBS.log)

Open File Explorer and use it to navigate to the C:\Windows\Logs\CBS folder. Then, double-click or double-tap on the CBS.log file to open it in your default text editor app. By default, that should be Notepad.

Results of the SFC CMD command are stored in the CBS log file

Then, either scroll down to the end of the file or use the search function in your text editor to look for any entries that begin with the text:

Cannot repair member file

Those lines of text will tell you which are the missing or corrupted system files that SFC couldn’t repair. Then, one of the best things you can do is use your favorite web browser and search engine to look for information online about the files mentioned in the CBS.log file. Hopefully, you’ll get some ideas on how to fix them.

Did the SFC CMD command help you repair Windows?

We hope you’ll never have to use the SFC command to repair Windows systems files. More often than not, that’s not a nice place to be. However, if your computer has issues, don't hesitate to consider using the System File Checker tool. It might come quite in handy if you have to deal with corrupted or missing system files. If you already encountered such a situation, did SFC manage to help you? Let us know in the comments section below.

Discover: Productivity Command Prompt Programs Recommended System Recovery Tutorials Windows
Join the discussion: See the comments Comment