Repair missing or corrupt Windows files with Command Prompt


To totally unlock this section you need to Log-in


Login

When you have problems with your computer, Windows system files may become corrupted or go missing. This might be caused by all kinds of issues like sudden power drops, hardware malfunctions, a hard disk approaching its "death" and so on. If Windows reports that it cannot 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 find. Here's how to use it:

NOTE: This tutorial applies to both Windows 7 and Windows 8.1.

In the Command Prompt window, use the sfc command with two additional parameters:

  • /offbootdir - used to specify the partition that contains the system files that are required for booting Windows. In most cases, this partition is going to be "C:\".
  • /offwindir - used to specify the location of the Windows directory. In most cases, this folder is "C:\Windows".

You will need to type something like: sfc /scannow /offbootdir=c:\ /offwindir=c:\windows and press Enter.

Repair missing or corrupt Windows files with Command Prompt

The "translation" for this command is the following: scan the Windows folder located on the boot partition "C:\" and fix missing or corrupt system files.

Arm yourself with some patience because running this command will take quite a bit of time. When the process finishes, you are informed that the verification is 100% complete. If problems were found, you are also informed. The problematic files that cannot be fixed are always mentioned in a log file named CBS.log. This file is found in the Windows folder, at this location: "C:\Windows\Logs\CBS\CBS.log".

If everything is fine with your system files, you will receive a message saying that: "Windows Resource Protection did not find any integrity violations".

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 that is the case for you, start the Command Prompt as an administrator.

Type the command: sfc /scannow and press Enter. The /scannow parameter forces the SFC tool to scan the integrity of all system files and repair problematic files when possible.

Repair missing or corrupt Windows files with Command Prompt

Again, arm yourself with some patience. The tool takes a long time to run. At least a couple of minutes. When it's done, you are informed that the verification is 100% complete. If problems were found, you are also informed. In our case, SFC found corrupt files and it was unable to fix some of them.

Repair missing or corrupt Windows files with Command Prompt

The problematic files that cannot be fixed are always mentioned in a log file named CBS.log. This file is found in the Windows folder, at this location: "C:\Windows\Logs\CBS\CBS.log".

How To Analyze The CBS.Log File

Go to "C:\Windows\Logs\CBS" and open the CBS.log. This file is quite large and it takes a while to open it in Notepad. If possible, open it with a different application like Notepad++ or Microsoft Word, so that it is opened faster and you have an easier time working with it.

Repair missing or corrupt Windows files with Command Prompt

Scroll towards the end of the file and search for entries that start with the text: "Cannot repair member file". There you will find the missing or corrupted system file(s) that cannot be repaired.

Repair missing or corrupt Windows files with Command Prompt

Search for information online about the file(s) mentioned in this log file and from there on you might get an idea on how to fix your problems.

Conclusion

Hopefully you will never need to use the SFC command to repair Windows systems files. However, if you do have issues, don't hesitate to consider using it. This tutorial should come in handy when you have to deal with system files being corrupted or missing.