Fix Corrupted Windows System Files with SFC and DISM
Random crashes, apps that won't open, Windows Update failing with odd error codes, a broken Start menu: these are classic signs of corrupted system files. Windows has two built-in tools for this, and the order you run them in matters.
Run everything below in an elevated terminal: right-click Start → Terminal (Admin) or Command Prompt (Admin). Works on Windows 10 and 11.
The short version
DISM /Online /Cleanup-Image /RestoreHealth
sfc /scannow
Run DISM first, then SFC. Restart afterwards.
What each tool does
| Tool | Repairs | Needs |
|---|---|---|
| SFC (System File Checker) | Replaces damaged protected files from the local component store | Nothing |
| DISM | Repairs the component store itself, which is SFC's source of good files | Internet (Windows Update) or a Windows image |
If the store is damaged, SFC has nothing good to copy from and fails. That's why DISM comes first.
Step 1: check and repair the component store
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth
CheckHealthis a quick check for existing damage flags.ScanHealthscans thoroughly, taking several minutes.RestoreHealthrepairs, downloading replacement files from Windows Update.
It's normal for the progress bar to sit at 20% or 62% for a long time. Don't cancel it. Details are in C:\Windows\Logs\DISM\dism.log.
Step 2: scan and repair system files
sfc /scannow
Possible results:
| Message | Meaning |
|---|---|
| did not find any integrity violations | Files are fine. Look elsewhere (drivers, software) |
| found corrupt files and successfully repaired them | Done. Restart |
| found corrupt files but was unable to fix some of them | Run DISM (step 1), then SFC again |
| could not perform the requested operation | Run it from Safe Mode or from the recovery environment |
Extract the details of what SFC could not repair:
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log > "%userprofile%\Desktop\sfc-details.txt"
SFC often needs two or three runs to settle. Run it until it reports clean.
If DISM cannot download files
Use a Windows ISO of the same version as the source. Mount it (right-click → Mount) and note the drive letter (here D:):
DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:\sources\install.wim:1 /LimitAccess
If your ISO contains install.esd instead of install.wim, use /Source:ESD:D:\sources\install.esd:1. The index (:1) must match your edition, and you can list them with DISM /Get-WimInfo /WimFile:D:\sources\install.wim.
If Windows won't boot
Boot from the installation USB → Repair your computer → Troubleshoot → Command Prompt, then run SFC against the offline installation:
sfc /scannow /offbootdir=C:\ /offwindir=C:\Windows
The drive letter of Windows can differ in recovery mode, so check with dir C:\.
Also check the disk
File corruption is often a symptom of a failing disk:
chkdsk C: /scan
Check health from PowerShell:
Get-PhysicalDisk | Select FriendlyName, MediaType, HealthStatus
A disk reporting Warning or Unhealthy needs replacing. Back up your data first.
Last resorts
- System Restore to a point before the problem started (
rstrui). - Settings → System → Recovery → Reset this PC → Keep my files. This reinstalls Windows and keeps your personal files, but apps need reinstalling.
- An in-place repair upgrade: run
setup.exefrom a matching ISO and choose Keep personal files and apps.