/commands/cmd/sfc-scannow-dism-restorehealth
sfc /scannow and DISM /RestoreHealth: repair Windows system files
- tool
- Command Prompt (cmd)
- versions
- Windows 10, Windows 11, Windows Server 2016+
- os
- windows
To repair corrupted Windows system files, open Command Prompt as administrator and run DISM first, then SFC:
DISM /Online /Cleanup-Image /RestoreHealth
sfc /scannowDISM repairs the component store (C:\Windows\WinSxS), the copy of system files that Windows uses as a source. sfc (System File Checker) then compares the protected system files in use with that store and replaces the ones that are damaged. Running DISM first means SFC does not repair files from a store that is itself damaged. Both commands take several minutes; let them finish.
DISM options
| Command | What it does |
|---|---|
| DISM /Online /Cleanup-Image /CheckHealth | quick: reports whether corruption was already flagged; repairs nothing |
| DISM /Online /Cleanup-Image /ScanHealth | scans the store for corruption; repairs nothing |
| DISM /Online /Cleanup-Image /RestoreHealth | scans and repairs, downloading good files from Windows Update |
| ... /RestoreHealth /Source:D:\sources\install.wim /LimitAccess | repair from installation media instead of Windows Update |
Use /Source with a Windows image of the same version and build when the machine has no internet access or Windows Update is managed by WSUS and cannot provide the files.
sfc options
| Command | What it does |
|---|---|
| sfc /scannow | scan all protected system files and repair them |
| sfc /verifyonly | scan only, no repair |
| sfc /scanfile=C:\Windows\System32\file.dll | scan and repair one file |
| sfc /scannow /offbootdir=C:\ /offwindir=C:\Windows | repair an offline Windows installation (from WinRE or another OS) |
Read the result
sfc /scannow ends with one of these outcomes: no integrity violations found; corrupt files found and repaired; or corrupt files found but some could not be repaired. Details are written to C:\Windows\Logs\CBS\CBS.log. To extract the SFC entries:
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log > "%USERPROFILE%\Desktop\sfcdetails.txt"If SFC still cannot repair files after DISM /RestoreHealth, run it again after a restart, then consider an in-place upgrade (repair install) of Windows.