Windows Repair Command Builder

Build SFC, DISM and chkdsk repair commands in the correct order.

Advertisement

Windows Repair Command Builder (SFC, DISM, chkdsk)

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.

The right order

DISM /Online /Cleanup-Image /RestoreHealth
sfc /scannow
chkdsk C: /f /r

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

DISM operations

CommandWhat it does
DISM /Online /Cleanup-Image /CheckHealthFast check of a previously recorded health flag
DISM /Online /Cleanup-Image /ScanHealthThorough scan for component-store corruption
DISM /Online /Cleanup-Image /RestoreHealthDownload 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

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.

chkdsk flags

  • /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.

Worked examples

sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth
chkdsk D: /f

Tips and pitfalls

  • Always run DISM before SFC when files are corrupt — SFC alone fails if the store it copies from is also damaged.
  • chkdsk on the boot drive cannot run while Windows is using it, so it queues for the next restart.
  • /r stresses a failing drive; if you suspect hardware failure, image the disk and back up data before running it.

Frequently Asked Questions

Should I run SFC or DISM first?+

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.

What is the difference between chkdsk /f and /r?+

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.

What does DISM RestoreHealth do?+

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.

Why does chkdsk run at reboot instead of immediately?+

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.

This tool is provided for informational and educational purposes only. All processing happens in your browser — no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results.