Skip to content

/commands/cmd/sfc-scannow-dism-restorehealth

sfc /scannow and DISM /RestoreHealth: repair Windows system files

The commands on this page have not been executed by our verification runner yet.updated
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:

cmd
DISM /Online /Cleanup-Image /RestoreHealth
sfc /scannow

DISM 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

CommandWhat it does
DISM /Online /Cleanup-Image /CheckHealthquick: reports whether corruption was already flagged; repairs nothing
DISM /Online /Cleanup-Image /ScanHealthscans the store for corruption; repairs nothing
DISM /Online /Cleanup-Image /RestoreHealthscans and repairs, downloading good files from Windows Update
... /RestoreHealth /Source:D:\sources\install.wim /LimitAccessrepair 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

CommandWhat it does
sfc /scannowscan all protected system files and repair them
sfc /verifyonlyscan only, no repair
sfc /scanfile=C:\Windows\System32\file.dllscan and repair one file
sfc /scannow /offbootdir=C:\ /offwindir=C:\Windowsrepair 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:

cmd
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.

Sources