How to Fix Windows Using CMD: SFC, DISM and CHKDSK in the Right Order
Run DISM before SFC, read what CBS.log says SFC couldn't fix, pick the right chkdsk switch and repair Windows offline from WinRE when it won't start.

Learning how to fix Windows using CMD comes down to three built-in tools, DISM, SFC and CHKDSK, run in the right order. Here’s that order, what each result means and what to do when Windows won’t start.
This guide shows how to fix Windows using CMD on Windows 11 and Windows 10 alike; only a few Settings paths differ.
Before You Start: Back Up and Open an Admin Command Prompt
A PC that keeps corrupting files may have a failing drive, and chkdsk /r puts a read load on every sector of it. Back up anything you can’t lose before you start.
Older guides on how to fix Windows using CMD check drive health with wmic diskdrive get status, but WMIC is removed from Windows 11 24H2 and later. Right-click Start, open Terminal (Windows PowerShell on Windows 10) and run Get-PhysicalDisk instead. If HealthStatus reads Warning or Unhealthy, back up now.
Knowing how to fix Windows using CMD starts with opening it the right way: every command below needs administrator rights. Click Start, type cmd and choose Run as administrator; on Windows 11, Win + X > Terminal (Admin) also works.

How to Fix Windows Using CMD: Which Command Fixes What
DISM: the repair source
Repairs the component store SFC copies from, using Windows Update by default.
SFC: system files
Replaces damaged or missing protected Windows files with copies from that store.
CHKDSK: the disk
Checks the file system and, with /r, searches for bad sectors.
Some guides on how to fix Windows using CMD run SFC first. But SFC copies its replacements from the component store, so a damaged store can make it fail; that’s why Microsoft’s own SFC guide runs DISM first.
These tools repair Windows itself, not compatibility problems. For an old program that won’t run on Windows 11, try a Windows XP virtual machine.
Step 1: Repair the Component Store With DISM
Microsoft’s walkthrough of how to fix Windows using CMD starts with DISM. /CheckHealth and /ScanHealth only check; /RestoreHealth also repairs, pulling files from Windows Update, so run it while online:DISM.exe /Online /Cleanup-Image /RestoreHealth
Keep the window open until the progress bar reaches 100% and DISM reports “The restore operation completed successfully.”
DISM error 0x800F081F: give it a local source
This code means DISM couldn’t find source files. Mount a Windows ISO that matches your version, edition and language by double-clicking it (E: here), then run dir E:\sources\install.* to see whether it holds install.wim or install.esd.
Find your edition’s index, then repair with it in place of N:DISM /Get-ImageInfo /ImageFile:E:\sources\install.wimDISM.exe /Online /Cleanup-Image /RestoreHealth /Source:Wim:E:\sources\install.wim:N /LimitAccess
/LimitAccess keeps DISM off Windows Update. If the PC has newer updates than the ISO, the repair may fail.
Media Creation Tool drives usually hold install.esd. In that case, type install.esd for install.wim in both commands and esd: for Wim:. Microsoft documents only the Wim: form, so if this fails, skip to Step 2.
Step 2: Run sfc /scannow and Decode the Result
SFC is the command most people picture when they look up how to fix Windows using CMD. Run it next:sfc /scannow
It usually ends with one of these four messages from Microsoft’s SFC guide:
- Did not find any integrity violations. System files are fine; move on to CHKDSK.
- Found corrupt files and successfully repaired them. Restart and run it again to confirm.
- Could not perform the requested operation. Run it in Safe Mode (WinRE > Troubleshoot > Advanced options > Startup Settings > Restart, then press 4) and check that PendingDeletes and PendingRenames exist in
%WinDir%\WinSxS\Temp. - Found corrupt files but was unable to fix some of them. SFC can’t fix everything; the log shows what’s left.
Read CBS.log to see what SFC couldn’t repair
Reading the log is the part of how to fix Windows using CMD that most people skip. SFC tags its lines in CBS.log with [SR], and this copies them to your desktop:findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"
If OneDrive backs up your desktop, add \OneDrive after %userprofile%.
“Cannot repair member file” marks a file SFC couldn’t fix; “Repairing corrupted file … from store” means it could. Microsoft’s log guide adds that a “Repairing” line during verification doesn’t prove a repair. For a stubborn file, Microsoft’s last resort is takeown, icacls and a good copy from a PC on the same Windows version.
Step 3: Check the Disk With CHKDSK (/scan vs /f vs /r)
If you’re reading about how to fix Windows using CMD because files won’t open or copies fail, this step matters most. A plain chkdsk C: only reports; the switches decide what it fixes:
| Switch | What it does | Use it for |
|---|---|---|
| /scan | Online scan, no restart (NTFS only) | A first check |
| /spotfix | Spot-fixes the volume (NTFS only; on C:, runs at restart) | Problems a scan found |
| /f | Fixes file system errors; locks the drive | Confirmed errors |
| /r | /f plus a bad-sector search that recovers readable data | Read errors, after a backup |
On C:, /f or /r reports that the volume is in use and offers a check at the next restart. Type Y and restart; the PC restarts again on its own afterwards.
The /r switch reads every sector; Microsoft’s chkdsk reference says runs lasting hours aren’t uncommon on large hard drives. Don’t interrupt it. On an SSD, start with /scan: an occasional /r is fine, but repeated passes add write/erase cycles.
Missed the result after the reboot? In Event Viewer, open Windows Logs > Application and look for the source Wininit (boot-time checks) or Chkdsk (online scans).
How to Fix Windows Using CMD When It Won’t Start
If Windows can’t boot, run the repairs offline from the Windows Recovery Environment (WinRE). That’s how to fix Windows using CMD without a working desktop.
Get into WinRE
Two failed starts open it automatically, or boot from install media and pick Repair your computer. If Windows still loads, use Shift + Restart.
Open Command Prompt
Troubleshoot > Advanced options > Command Prompt. Windows 10 asks for a local admin password; encrypted PCs may need the BitLocker key.
Find the Windows drive
Letters change in WinRE, so don’t assume C:. Try dir D:\Windows and other letters, or diskpart, list volume, then exit.
Repair offline
Run the commands below, then close the window and choose Continue.
Offline, the desktop version of how to fix Windows using CMD stops working: a plain sfc /scannow errors out or checks the wrong volume. WinRE has no network by default, so DISM needs your install USB as its source. WinRE’s RAM disk can also be as small as 32 MB, so give DISM a scratch folder on the Windows drive.
With Windows on D: and the USB on E: (N as in Step 1), run:mkdir D:\ScratchDISM /Image:D:\ /ScratchDir:D:\Scratch /Cleanup-Image /RestoreHealth /Source:Wim:E:\sources\install.wim:N /LimitAccesssfc /scannow /offbootdir=D:\ /offwindir=D:\Windows
With only install.esd, make the esd: swap from Step 1. If DISM still fails, skip it; offline SFC repairs from the drive’s own store if that store is intact.

What About Registry Errors? Why Registry Cleaners Aren’t the Answer
Registry errors are where advice on how to fix Windows using CMD goes wrong most often. No built-in command cleans the registry, and Microsoft’s support policy on registry cleaning utilities (KB 2563254) states that it doesn’t support them. Their damage may need a reinstall, and some free ones carry spyware, adware or viruses.
Copying hives from the RegBack folder is a dead trick too: since Windows 10 version 1803 those files are 0 KB unless someone re-enabled the old backup (EnablePeriodicBackup), so there’s usually nothing to copy.
For a corrupt registry, Microsoft recommends System Restore, which leaves personal files alone but needs System Protection to have been on and a restore point to exist (WinRE > Troubleshoot > Advanced options > System Restore).
On Windows 11 24H2 and later, WinRE’s Troubleshoot > Point-in-time restore, where it’s turned on, rolls the whole PC back up to 72 hours, personal files included, so anything newer is lost. With neither option, use the in-place reinstall below.
If a forum answer on how to fix Windows using CMD tells you to edit a registry key, select that key in Registry Editor and back it up with File > Export first.
Frequently Asked Questions
Should I run DISM or SFC first?
DISM first, then SFC, since SFC repairs from the store DISM fixes.
Can I run these commands in PowerShell instead of CMD?
Yes, with one exception. This guide on how to fix Windows using CMD works the same in PowerShell for DISM, sfc and chkdsk. The findstr line needs CMD, because PowerShell doesn’t expand %windir% or %userprofile%, so type cmd first.
Will SFC, DISM or chkdsk delete my files or apps?
SFC and DISM only replace Windows system files. CHKDSK normally doesn’t remove files either, but repairing a damaged file system can drop files that are already corrupt, and on FAT drives lost pieces become File<nnnn>.chk files. That’s why you back up first. Reset this PC and Point-in-time restore can remove apps or roll back files.
If the Commands Don’t Fix It: Reinstall in Place or Reset
The short version of how to fix Windows using CMD: DISM, then SFC, then CHKDSK. If DISM can’t find a source and SFC keeps logging “Cannot repair member file,” stop repeating them.
On Windows 11 22H2 or later, Settings > System > Recovery > Fix problems using Windows Update > Reinstall now reinstalls Windows and keeps your files, apps and settings. Next, uninstall the latest update or use System Restore; Reset this PC comes last. If it fails, see there was a problem resetting your PC, or browse more software and apps fixes.





Leave a comment