How do I run a filesystem check on Windows and repair system files?

If Windows is freezing or behaving erratically, there might be a problem with the filesystem or system files. Examples of erratic behavior include:

  • blue screens
  • crashing applications
  • sluggish performance
  • failed Windows updates

You can use the built-in Deployment Image Servicing and Management (DISM) and System File Checker (SFC) tools to try to fix the problem.

To use the DISM tool to fix problems with the filesystem or system files:

  1. Press the Windows key + R to open the Run window.

  2. In the Run window, type cmd then press Ctrl + Shift + Enter.

    This command opens the Command Prompt window with elevated (admin) privileges.

  3. In the Command Prompt window, run the command:

    DISM.exe /Online /Cleanup-Image /RestoreHealth
    

    This command performs cleanup and recovery operations on the system files. For more information, see Microsoft’s documentation on repairing a Windows image.

  4. After DISM.exe finishes, run the following command in the Command Prompt window: sfc /scannow. This command scans all protected system files and replaces corrupted files. For more information, see Microsoft’s documentation on using SFC to repair missing or corrupted system files.

Run the sfc /scannow command up to 3 times until you receive the message: Windows Resource Protection did not find any integrity violations.

Reboot the machine and test to see if Windows continues to freeze or behave erratically.


Last modified February 11, 2023: Use more popular name (8ae4ab5)