Build SFC, DISM and chkdsk repair commands in the correct order.
When Windows misbehaves — crashes, corrupt system files, or a disk throwing errors — three built-in tools fix the most common causes: DISM repairs the Windows component store, SFC restores corrupted system files from it, and chkdsk fixes file-system and disk errors. This builder runs them in the correct order, because the order matters: SFC pulls its known-good files from the component store, so DISM must repair that store first.
DISM /Online /Cleanup-Image /RestoreHealth
sfc /scannow
chkdsk C: /f /rRun all three from an elevated (Administrator) prompt. DISM repairs the image SFC depends on, SFC then replaces damaged system files, and chkdsk checks the disk itself. On the system drive, chkdsk schedules itself for the next reboot — answer Y when prompted.
| Command | What it does |
|---|---|
DISM /Online /Cleanup-Image /CheckHealth | Fast check of a previously recorded health flag |
DISM /Online /Cleanup-Image /ScanHealth | Thorough scan for component-store corruption |
DISM /Online /Cleanup-Image /RestoreHealth | Download and repair corrupted store files via Windows Update |
If the PC has no internet or Windows Update is broken, point DISM at a known-good source: /RestoreHealth /Source:D:\Sources\install.wim:1 /LimitAccess.
sfc /scannow scans all protected system files and replaces corrupted ones with cached good copies from the component store. If SFC reports it could not fix everything, run DISM /RestoreHealth and then SFC again — SFC can only repair from a healthy store.
/f — fix file-system errors (the metadata that tracks where files live)./r — locate bad sectors and recover readable data. Implies /f and can take hours on a large disk, so back up important data first.sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth
chkdsk D: /f/r stresses a failing drive; if you suspect hardware failure, image the disk and back up data before running it.Run DISM first when system files are corrupt. SFC repairs damaged files by copying known-good versions from the Windows component store, so if that store is also damaged, SFC cannot fix everything. DISM /RestoreHealth repairs the store, then sfc /scannow can do its job.
The /f flag fixes file-system errors in the disk metadata. The /r flag also scans the surface for bad sectors and recovers readable data, and it implies /f. Because /r reads the entire disk it can take hours and is best run when you suspect physical disk problems.
DISM /Online /Cleanup-Image /RestoreHealth scans the Windows component store for corruption and repairs it, normally downloading replacement files through Windows Update. If the PC is offline, you can point it at a known-good install.wim with the /Source option.
chkdsk cannot get exclusive access to a drive that Windows is actively using, and the system drive is always in use. When you run chkdsk C: /f on the boot volume it schedules itself to run during the next restart, before Windows fully loads.