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.

Jun 30, 2025 - 12:32
Updated: 1 month ago
111.1k
What Are the Essential Windows Repair Commands? How to Fix Windows Errors Using CMD (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?

ProblemStart withWhere to run it
Apps crash, missing DLL errors, odd behaviourDISM... /RestoreHealth, then sfc /scannowAdmin Command Prompt
Disk errors, "repairing drive" messages, corrupt fileschkdsk C: /f (add /r on a hard disk you suspect is failing)Admin Command Prompt, runs at restart
Windows Update stuck or failingReset the update services and cacheAdmin Command Prompt
PC won't boot, boot loop, "no bootable device"Startup Repair, then bcdboot or bootrecWindows Recovery Environment
Problems began after a driver or updateSystem Restore (rstrui) or uninstall the updateWindows or Recovery
Random blue screens or freezesmdsched (memory test), then chkdsk and SFCAdmin Command Prompt

Before you start: two quick safety steps

  1. 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.
  2. 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.

CommandWhat it does
chkdsk C: /scanOnline check while Windows keeps running (NTFS only)
chkdsk C: /fFixes file system errors
chkdsk C: /rAlso locates bad sectors and recovers readable data (slow)
chkdsk D: /fSame 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, /scan or /f is usually enough. A full /r surface scan takes a long time and adds little; SSD health is better checked with the manufacturer's tool.
  • On a hard disk, /r can 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.

  1. Go to Troubleshoot > Advanced options > Startup Repair and let it run. It fixes many boot problems automatically.
  2. If that fails, open Command Prompt from the same menu.
  3. Find your Windows drive. In recovery it is often not C:. Run diskpart, then list vol, note the letter of the large NTFS volume, then exit. Check with dir D:\Windows.
  4. If the drive is BitLocker-encrypted, enter your recovery key: manage-bde -unlock D: -RecoveryPassword YOUR-48-DIGIT-KEY
  5. 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 optionWhat it does
rstruiOpens System Restore to roll back system files, drivers and settings to a restore point. Personal files are not affected.
mdschedWindows Memory Diagnostic. Restarts and tests RAM, a common hidden cause of blue screens.
msconfigLets you do a clean boot (Microsoft services only) to find a conflicting app or driver.
eventvwr.mscEvent Viewer. Check Windows Logs > System for disk, driver and crash errors before guessing.
Settings > System > Recovery > Fix problems using Windows UpdateOn 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 PCLast 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

  1. Restart and install pending updates. Note any error codes.
  2. Run DISM /Online /Cleanup-Image /RestoreHealth, then sfc /scannow.
  3. Run chkdsk C: /f and restart.
  4. If the trouble began after a change, use System Restore or uninstall the update or driver.
  5. On Windows 11, use Fix problems using Windows Update.
  6. 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 vol before repairing.
  • Using bootrec /fixboot on UEFI PCs. Use bcdboot instead.
  • 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

Run DISM /Online /Cleanup-Image /RestoreHealth first, then sfc /scannow. SFC repairs system files from a local copy, and DISM repairs that copy. If you run SFC first and it reports files it cannot fix, run DISM and then SFC again.

Open Command Prompt as administrator, run DISM /Online /Cleanup-Image /RestoreHealth, wait for it to finish, then run sfc /scannow. Restart afterwards. If SFC still reports unfixable files, repeat both steps or use DISM with installation media as the source.

chkdsk /f fixes file system errors on the volume. chkdsk /r does everything /f does and also scans for bad sectors and recovers readable data, so it is much slower. Use /r only when you suspect physical problems on a hard disk.

This usually happens on UEFI PCs with GPT disks, where bootrec cannot write to the EFI system partition. Instead, assign a letter to the small FAT32 EFI partition with diskpart and rebuild the boot files using bcdboot C:\Windows /s S: /f UEFI, adjusting the drive letters.

No. DISM, SFC, chkdsk, bootrec and bcdboot repair system files, disk structures and boot records, not personal documents. However, a failing disk can lose data during a long scan, so back up important files before running repairs.

By default DISM RestoreHealth downloads clean files from Windows Update, so it needs internet. Without it, point DISM at an install.wim or install.esd file from matching Windows installation media using the /Source option, and add /LimitAccess to stop it contacting Windows Update.

It usually takes between a few minutes and around half an hour, depending on disk speed and how much needs repairing. It can pause at certain percentages. Let it finish rather than closing the window.

Let Windows fail to boot two or three times so the Recovery Environment opens, or boot from a Windows USB and select Repair your computer. Then choose Troubleshoot, Advanced options, Command Prompt. Remember the Windows drive may not be C: there.

In Windows 11, open Settings, System, Recovery and choose Reinstall now under Fix problems using Windows Update. It reinstalls the current Windows version while keeping your apps, files and settings. It needs internet and power, and may be unavailable on work-managed PCs.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.