brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: sfc /scannow repairs corrupted Windows system files

Windows
~/tips/tip-windows-sfc-scannow

sfc /scannow

Scans protected system files and replaces damaged ones with a cached good copy, from an admin prompt.

When Windows acts strangely after a failed update or a crash, a damaged system file is one possible reason. System File Checker is the built-in way to test that.

DISM.exe /Online /Cleanup-image /Restorehealth
sfc /scannow

Open Command Prompt as administrator first, by right-clicking it and choosing Run as administrator. Without it the scan will not run properly.

Microsoft’s own instructions run DISM before SFC. DISM /Online /Cleanup-image /Restorehealth repairs the component store, which SFC uses as its source of good files. By default DISM fetches replacements from Windows Update, and it can take several minutes. Then sfc /scannow replaces corrupted protected files with a cached copy. Keep the window open until it finishes.

The result tells you what happened: no integrity violations, corrupt files repaired, or corrupt files found that could not be fixed.

The caveat is that last result. SFC records its work in CBS.log, and Microsoft shows how to pull the SFC lines into a text file on the desktop:

findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"

The file mixes entries from every run, so check the timestamps. If files remain unfixable, Microsoft’s last advice is to reinstall Windows through the recovery options, so keep a backup before it gets that far.

Further reading: Microsoft Support: use the System File Checker tool

More Windows tips Win+Ctrl+C Win+Shift+Left arrow Win+Ctrl+Left arrow Alt+PrtScn Left Alt + Left Shift + Print Screen All Windows tips (33) All topics

Link