Command Prompt - Repair Missing or Corrupt Files

Sometimes important Windows 7 system files can get corrupted or become missing, due to unexpected events like a sudden power drop or some hardware or software malfunctions. One of the tools which can help in such cases is System File Checker (SFC). This is a command-line system tool that scans the integrity of Windows 7 system files and replaces the damaged or missing system files. In this article you will learn how to use this utility from the Command Prompt to solve your problems.

NOTE: When a corrupt or missing system file prevents the operating system from booting normally, you need to use the Windows 7 setup DVD or a System Repair Disc to start the Command Prompt and, from there the System File Checker (SFC). If Windows 7 boots, but you get messages about missing system files, you will be able to fix the problem by running the System File Checker (SFC) in the Command Prompt (NOTE: must be run as administrator).

NOTE: Check out How to Run Programs as Administrator in Windows 7 to see how to run the Command Prompt as administrator.

Fix Missing or Corrupt Files When the Computer Won't Boot

First of all, follow the steps described in the Overview of System Recovery Options for Windows 7 article to learn how to launch the Command Prompt tool.

In the Command Prompt window, use the sfc command with two additional parameters: /offbootdir and /offwindir.

The parameter /offbootdir is used to specify the boot partition - the partition that contains the boot files needed for booting Windows 7. The /offwindir parameter is designed to specify the location of the Windows 7 directory.

For example, I wanted to scan the drive that contains my operating system. On my computer it was D:. On most computers, it generally is C:. The directory where Windows 7 is installed on my computer is D:\Windows. On most computers, it generally is C:\Windows.

Therefore I need to type sfc /scannow /offbootdir=d:\ /offwindir=d:\windows and press Enter. The translation for this command is: scan the windows folder located on boot partition, in this case the D: partition, and fix missing or corrupt files.

Command Prompt

If any corrupt or missing files are found, they are repaired automatically.

Fix Missing or Corrupt Files When Your Computer Boots

When your computer boots, simply open the Command Prompt as administrator and type sfc /scannow. The /scannow parameter allows you to scan the integrity of all protected system files and repairs the problematic files when possible. In the picture below you can see how this command works.

Command Prompt

If any corrupt files are found, they are repaired automatically and a log file is created, generally found at this location: C:\Windows\Logs\CBS\CBS.log. The result of the command is displayed below.

Command Prompt


Hopefully you won't need to use this command to repair your systems files. However, if you do have issues, don't hesitate to consider using it. Hopefully this tutorial will be useful to you when in need.
If you have any questions, don't hesitate to leave a comment.