What Are the Essential Windows Repair Commands? How to Fix Windows Errors Using CMD (2026)
Discover the most essential Windows repair commands like sfc /scannow, chkdsk, DISM, and more. Learn how to use these tools to fix boot errors, system crashes, Windows Update issues, and disk problems, all without reinstalling your OS. Perfect for beginners and IT support alike in 2026.
Quick answer: The essential Windows repair commands are DISM /Online /Cleanup-Image /RestoreHealth to repair the Windows image, sfc /scannow to fix system files, chkdsk C: /f or /r for file system and disk errors, and bootrec or bcdboot for boot problems. Run them from an administrator Command Prompt, or from Windows Recovery if Windows won't start. Back up first.
Key takeaways
- Run DISM /RestoreHealth before sfc /scannow, because SFC repairs files from the component store that DISM fixes first.
- Use chkdsk C: /f for file system errors and add /r only on a drive you suspect is failing, since it takes much longer.
- Back up first and run commands from an administrator Command Prompt, or from Windows Recovery when the PC will not boot.
Most Windows faults, such as crashing apps, failed updates or a PC stuck before the login screen, can be fixed without reinstalling. The trick is knowing which command fits which problem and running them in the right order. Everything below works on Windows 11 and Windows 10.
Which repair command fixes which problem?
| Problem | Start with | Where to run it |
|---|---|---|
| Apps crash, missing DLL errors, odd behaviour | DISM... /RestoreHealth, then sfc /scannow | Admin Command Prompt |
| Disk errors, "repairing drive" messages, corrupt files | chkdsk C: /f (add /r on a hard disk you suspect is failing) | Admin Command Prompt, runs at restart |
| Windows Update stuck or failing | Reset the update services and cache | Admin Command Prompt |
| PC won't boot, boot loop, "no bootable device" | Startup Repair, then bcdboot or bootrec | Windows Recovery Environment |
| Problems began after a driver or update | System Restore (rstrui) or uninstall the update | Windows or Recovery |
| Random blue screens or freezes | mdsched (memory test), then chkdsk and SFC | Admin Command Prompt |
Before you start: two quick safety steps
- Back up your files. Repair commands don't delete personal files, but a failing disk can get worse during a long scan. Copy important data to an external drive or cloud first.
- Find your BitLocker recovery key. Many Windows 11 laptops encrypt the drive by default. In the Recovery Environment you will need the key to open the encrypted C: drive. It is usually saved in your Microsoft account. Our guide to how BitLocker works explains where keys are stored.
To open an administrator Command Prompt, press the Windows key, type cmd, right-click Command Prompt and choose Run as administrator. Windows Terminal (Admin) works too.
How do you repair corrupted system files with DISM and SFC?
Run DISM first, then SFC. SFC replaces damaged system files using a local copy kept by Windows; if that copy is itself damaged, SFC can't finish the job. DISM repairs that copy first, normally by downloading clean files from Windows Update.
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth
sfc /scannow
- CheckHealth reports quickly whether corruption has already been recorded.
- ScanHealth does a deeper scan and takes several minutes.
- RestoreHealth repairs the image. It may appear stuck at 20% or 62% for a while; that is normal, so let it run.
- sfc /scannow then checks every protected system file and replaces bad ones.
When SFC finishes you'll see one of three results: no integrity violations found, corrupt files found and repaired, or corrupt files found but some could not be fixed. For the third case, run the DISM step again, restart and repeat SFC. To see which files were affected, export the details from the log:
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log > "%userprofile%\Desktop\sfcdetails.txt"
No internet or Windows Update broken? Point DISM at Windows installation media of the same version instead. Mount the ISO (say it becomes drive E:) and run:
DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:E:\sources\install.wim:1 /LimitAccess
The number after install.wim is the edition index; check it with DISM /Get-WimInfo /WimFile:E:\sources\install.wim. If your media has install.esd instead, use esd: in place of wim:. Microsoft documents these options in its Repair a Windows Image guide.
How do you fix disk errors with chkdsk?
Use chkdsk C: /f to fix file system errors, and chkdsk C: /r when you suspect bad sectors. /r already includes everything /f does, so you don't need both.
| Command | What it does |
|---|---|
chkdsk C: /scan | Online check while Windows keeps running (NTFS only) |
chkdsk C: /f | Fixes file system errors |
chkdsk C: /r | Also locates bad sectors and recovers readable data (slow) |
chkdsk D: /f | Same check on another drive |
The system drive is always in use, so chkdsk asks to run at the next restart. Type Y and reboot. Don't power off while it runs.
- On an SSD,
/scanor/fis usually enough. A full/rsurface scan takes a long time and adds little; SSD health is better checked with the manufacturer's tool. - On a hard disk,
/rcan take hours. If it keeps finding new bad sectors, the disk is failing: copy your data off and replace it rather than repairing it again.
How do you reset Windows Update from CMD?
Stop the update services, rename the two cache folders so Windows rebuilds them, then start the services again:
net stop wuauserv
net stop bits
net stop cryptsvc
net stop msiserver
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
ren C:\Windows\System32\catroot2 catroot2.old
net start wuauserv
net start bits
net start cryptsvc
net start msiserver
Restart, then check for updates again. If a "folder in use" error stops the rename, a service didn't stop; run the matching net stop again. You can delete the .old folders once updates work. Also run the Windows Update troubleshooter (Settings > System > Troubleshoot) and the DISM plus SFC pair above, since update failures often come from a damaged component store.
How do you fix Windows when it won't boot?
Use the Windows Recovery Environment (WinRE). Windows opens it automatically after two or three failed starts. You can also hold Shift while clicking Restart, or boot from a Windows USB and choose Repair your computer.
- Go to Troubleshoot > Advanced options > Startup Repair and let it run. It fixes many boot problems automatically.
- If that fails, open Command Prompt from the same menu.
- Find your Windows drive. In recovery it is often not C:. Run
diskpart, thenlist vol, note the letter of the large NTFS volume, thenexit. Check withdir D:\Windows. - If the drive is BitLocker-encrypted, enter your recovery key:
manage-bde -unlock D: -RecoveryPassword YOUR-48-DIGIT-KEY - Repair the boot files with the steps for your firmware type below.
Modern PCs (UEFI with GPT disk)
Almost every PC sold in recent years uses UEFI. Here bootrec /fixboot often fails with "Access is denied", so rebuild the boot files with bcdboot instead:
diskpart
list vol
select vol 1
assign letter=S
exit
bcdboot D:\Windows /s S: /f UEFI
The EFI system partition is the small FAT32 volume, usually 100 to 300 MB. Replace vol 1 with its number from your list, and D: with your Windows drive. The full syntax is in Microsoft's BCDBoot reference.
Older PCs (legacy BIOS with MBR disk)
bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd
/fixmbr rewrites the master boot record, /fixboot writes a new boot sector, /scanos lists Windows installations, and /rebuildbcd adds them back to the boot menu. None of these touch your personal files.
Repair system files when Windows won't start
SFC can also check an offline Windows installation from the recovery prompt:
sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows
Other built-in repair tools worth knowing
| Command or option | What it does |
|---|---|
rstrui | Opens System Restore to roll back system files, drivers and settings to a restore point. Personal files are not affected. |
mdsched | Windows Memory Diagnostic. Restarts and tests RAM, a common hidden cause of blue screens. |
msconfig | Lets you do a clean boot (Microsoft services only) to find a conflicting app or driver. |
eventvwr.msc | Event Viewer. Check Windows Logs > System for disk, driver and crash errors before guessing. |
| Settings > System > Recovery > Fix problems using Windows Update | On Windows 11, reinstalls the current version of Windows from Windows Update while keeping apps, files and settings. A good step before a full reset. |
| Reset this PC | Last resort. Reinstalls Windows with an option to keep personal files; installed apps are removed. |
About regedit: it opens the Registry Editor. It isn't a repair command, and editing the registry without a specific, trusted fix can stop Windows booting. If you must change a key, export it first (File > Export) so you can undo the change.
A sensible repair order
- Restart and install pending updates. Note any error codes.
- Run
DISM /Online /Cleanup-Image /RestoreHealth, thensfc /scannow. - Run
chkdsk C: /fand restart. - If the trouble began after a change, use System Restore or uninstall the update or driver.
- On Windows 11, use Fix problems using Windows Update.
- Only then consider Reset this PC.
Common mistakes to avoid
- Running commands without admin rights. SFC replies "You must be an administrator". Reopen CMD as administrator.
- Assuming C: in recovery. Drive letters change in WinRE; check with
list volbefore repairing. - Using
bootrec /fixbooton UEFI PCs. Usebcdbootinstead. - Cancelling DISM or chkdsk midway. Interrupting a repair can leave things worse than before.
- Repairing a dying disk repeatedly. If chkdsk keeps finding bad sectors, replace the drive.
- Still running Windows 10 without updates. Windows 10 reached end of support in October 2025, so repairs won't fix the lack of security patches. Plan an upgrade.
Next step
Save the commands in this guide somewhere you can reach from another device, because you'll need them most when Windows won't start. To get faster at the command line in general, work through our list of 70 essential Windows CMD commands, and if the fault turns out to be connectivity rather than Windows itself, follow this step-by-step network troubleshooting guide.
Related reading
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0