Windows Guide

SFC, DISM, CHKDSK and Friends: The Windows Repair Commands Worth Knowing

When Windows starts misbehaving (settings that won't open, updates that fail at 0x800-something, a Start menu that freezes), forum threads tend to answer with a wall of commands. People paste them in order and hope. That usually does no harm, but it's worth knowing what each command does, because then you can tell which one fits your problem instead of running everything and waiting an hour.

All of these need an administrator Terminal: right-click the Start button and choose Terminal (Admin).

sfc /scannow

System File Checker compares protected Windows files against known-good copies and replaces any that are damaged or modified. It's the first thing to try when built-in parts of Windows behave strangely.

sfc /scannow

It takes 5 to 15 minutes. You'll get one of three outcomes. Did not find any integrity violations means system files are fine and your problem lies elsewhere. Found corrupt files and successfully repaired them means restart and check again. Found corrupt files but was unable to fix some of them means the local repair source is itself damaged, which is where DISM comes in.

DISM /RestoreHealth

SFC repairs files from the component store in C:\Windows\WinSxS. If that store is damaged, SFC has nothing good to copy from. DISM repairs the store itself, downloading clean components from Windows Update:

DISM /Online /Cleanup-Image /RestoreHealth

It can sit at 20% or 62% for a long time without moving. That's normal; leave it. When it finishes, run sfc /scannow again so SFC can use the now-healthy store. The right order is DISM first, then SFC, whenever SFC reports files it couldn't fix.

There are two lighter variants: /CheckHealth only reads a flag that says whether corruption was previously detected, and /ScanHealth does a full check without repairing. In practice, if you suspect a problem, go straight to /RestoreHealth.

chkdsk

CHKDSK checks the file system on a drive: the structures that track where files live. It's the tool for "the drive is fine but files are acting weird" problems, especially after a power cut or a crash during heavy writing.

chkdsk C: /scan

On modern NTFS volumes, /scan runs online without restarting and reports problems. If it finds any, chkdsk C: /spotfix schedules a quick repair at the next restart. The old habit of running chkdsk /f /r on every problem is mostly outdated: /r reads every sector of the drive looking for bad ones, which can take hours on a large disk and tells you little an SSD's own health data wouldn't.

Speaking of which, CHKDSK doesn't tell you whether a drive is dying. For that, look at the drive's SMART health. Settings → System → Storage → Advanced storage settings → Disks & volumes → Properties shows an estimated remaining life for NVMe SSDs, and the free CrystalDiskInfo shows full SMART data for any drive.

Network reset commands

When some websites won't load but others do, or the connection works but name lookups fail, these are the usual fixes:

  • ipconfig /flushdns clears Windows' DNS cache. Useful after a site moved servers or after changing DNS settings.
  • ipconfig /release then ipconfig /renew asks the router for a fresh IP address.
  • netsh winsock reset resets the Windows networking stack's settings, which some VPN and security software leave in a bad state. Needs a restart.

If all of that fails, Settings → Network & internet → Advanced network settings → Network reset removes and reinstalls every network adapter. It's the nuclear option. You'll need to reconnect to Wi-Fi and reinstall VPN clients afterwards.

Reports Windows can write for you

These don't fix anything, but they answer questions that are otherwise guesswork.

Battery report

powercfg /batteryreport

Writes an HTML file (the command tells you where) with your battery's design capacity, its current full-charge capacity and a history of usage. If the full-charge capacity is 60% of design capacity, your battery has worn out, and no setting will bring back the old runtime.

Sleep study

powercfg /sleepstudy

On laptops that use Modern Standby, this report shows what drained the battery while the lid was closed. If your laptop loses 20% overnight, this is where you'll find out which device or app kept it awake.

What's keeping the PC awake

powercfg /requests

Lists any app or driver currently blocking sleep or keeping the display on. A browser tab playing muted audio is a classic one.

Reliability history

Not a command, but worth knowing: search for View reliability history. It shows a day-by-day timeline of app crashes, failed updates and Windows errors. When someone says "it started crashing last week", this tells you what changed last week.

A sensible order when Windows is acting up

  1. Restart (a real Restart, not Shut down, because Fast Startup keeps parts of the old session).
  2. Install pending Windows updates and driver updates.
  3. Run DISM /Online /Cleanup-Image /RestoreHealth, then sfc /scannow.
  4. Run chkdsk C: /scan.
  5. Check Reliability history for patterns.
  6. If it's networking, try the network commands above.

If you've done all of that and the problem's still there, Windows' Fix problems using Windows Update option (under Settings → System → Recovery) reinstalls the current version of Windows while keeping your apps and files. It takes about an hour and fixes most of what's left short of a clean install.