Cheat Sheets

Windows Repair Commands Cheat Sheet: SFC, DISM, chkdsk (PDF)

A Windows repair cheat sheet saves you guessing which tool to run when a machine throws DLL errors, fails Windows Update or will not boot. You pick the command by the layer that broke: System File Checker for protected files, DISM for the component store those files come from, chkdsk for the volume underneath, and bootrec, bcdboot and reagentc when the boot path or the recovery environment is gone.

Original content from computingforgeeks.com - post 195171

This sheet groups the commands in the order you would use them on Windows 11 and Windows Server 2025, with the syntax matched against Microsoft’s own reference pages in November 2026. Every command runs from an elevated prompt, and the boot fixes run from the recovery environment’s command prompt.

Which Windows repair command should you run first?

Start with sfc /scannow for a quick check, and switch to DISM when SFC reports files it could not fix. Microsoft describes SFC as the quick check and DISM as the more extensive repair of the component store, so once SFC fails, repair the store with DISM and run SFC again. Use chkdsk only if the event log or SFC points at the disk.

  • Windows boots but system files are damaged: SFC, then DISM and SFC again.
  • Errors mention the volume or bad sectors: chkdsk.
  • Windows does not boot: bootrec or bcdboot from the recovery command prompt.
  • The recovery menu itself is missing: reagentc.

Every command below needs an elevated prompt, so open Command Prompt or PowerShell with Run as administrator before you start. From a standard prompt SFC and DISM refuse to run at all, so an error about privileges means the window, not the system, is the problem.

Windows Repair Commands Cheat Sheet (Quick Reference)

The tables are grouped by tool, and each row is the short form you would type at the prompt. Drive letters assume Windows on C: and the install media on D:, so swap them for yours.

System File Checker

CommandWhat it does
sfc /scannowScan and repair protected system files on the running OS

DISM component store

CommandWhat it does
Dism /Online /Cleanup-Image /CheckHealthReport whether the image is healthy, repairable or non-repairable
Dism /Online /Cleanup-Image /ScanHealthFull scan of the component store for corruption
Dism /Online /Cleanup-Image /RestoreHealthRepair using the default source (Windows Update or policy)
Dism /Mount-Image /ImageFile:D:\sources\install.wim /Index:1 /MountDir:C:\mount /ReadOnlyMount the media image to use as a repair source
Dism /Online /Cleanup-Image /RestoreHealth /Source:C:\mount\windows /LimitAccessRepair from a local source only, never Windows Update
Dism /Image:C:\offline /Cleanup-Image /RestoreHealth /Source:C:\mount\windowsRepair an offline image
Dism /Cleanup-MountpointsClean up corrupted mount points

chkdsk

CommandWhat it does
chkdsk C:Read-only status check, fixes nothing
chkdsk C: /scanOnline NTFS scan while the volume stays in use
chkdsk C: /spotfixRun spot fixing on the volume (at the next restart on C:)
chkdsk C: /fFix logical errors; needs a lock or a reboot
chkdsk C: /rSame as /f plus a bad sector scan

Boot repair and recovery environment

CommandWhat it does
bootrec /scanosList Windows installs not in the BCD store
bootrec /rebuildbcdRebuild the BCD store from found installs
bootrec /fixmbrRewrite master boot code (BIOS/MBR disks)
bootrec /fixbootRewrite the boot sector (often Access is denied on UEFI)
bcdboot C:\WindowsRecreate boot files and BCD from the Windows folder
bcdboot C:\Windows /s S: /f UEFIWrite UEFI boot files to S:, no firmware boot entry
bcdedit /export C:\bcdbackupBack up the BCD store before changing it
reagentc /infoShow whether Windows RE is enabled and where it lives
reagentc /enableEnable Windows RE
reagentc /boottoreBoot into Windows RE on the next restart

Winsock

CommandWhat it does
netsh winsock show catalogList the Winsock providers and LSPs
netsh winsock resetReset the Winsock catalog, removing custom LSPs

Microsoft’s netsh winsock reference notes the reset leaves namespace provider entries alone, so it strips custom LSPs from the catalog while the namespace providers stay registered. The sections below explain when each group fits and which flags change its behaviour. Most of the time lost on a broken machine goes on running the right tool with the wrong switch.

How do you repair the component store with DISM?

You repair it with /RestoreHealth, after /CheckHealth or /ScanHealth tells you the image is repairable. Microsoft’s reference describes /CheckHealth as the quick verdict and /ScanHealth as the longer scan, so start with the quick one:

Dism /Online /Cleanup-Image /CheckHealth

Without a /Source, DISM fetches replacement files from the Features on Demand location your Group Policy sets, which is usually Windows Update. On a server with no internet access, mount the install.wim from the install media (here D:) read-only, then point DISM at its Windows folder:

mkdir C:\mount
Dism /Mount-Image /ImageFile:D:\sources\install.wim /Index:1 /MountDir:C:\mount /ReadOnly

Pick the index of your edition from Dism /Get-WimInfo /WimFile:D:\sources\install.wim. The media has to be the same build as the installed Windows, as Brink’s ElevenForum tutorial notes for its install-media option, and Microsoft adds that a source older than the installed cumulative update can still fail. Then run the repair with /LimitAccess so it never falls back to Windows Update:

Dism /Online /Cleanup-Image /RestoreHealth /Source:C:\mount\windows /LimitAccess

If you pass more than one /Source, DISM copies from the first location that has the file and ignores the rest. Unmount the image afterwards with Dism /Unmount-Image /MountDir:C:\mount /Discard.

An ISO from the Media Creation Tool holds install.esd instead, which DISM cannot mount. Skip the mount steps: the TenForums DISM tutorial points DISM straight at the file, with the index of your edition from Dism /Get-WimInfo /WimFile:D:\sources\install.esd after the last colon:

Dism /Online /Cleanup-Image /RestoreHealth /Source:esd:D:\sources\install.esd:1 /LimitAccess

Do not kill a repair that sits at 20 percent: How-To Geek and TenForums both describe the progress bar stalling there for a while before it moves on. When it does fail, check these before you retry:

  • C:\Windows\Logs\DISM\dism.log names the error and the source DISM tried.
  • C:\Windows\Logs\CBS\CBS.log lists the component files it could not repair.
  • The source matches the installed build and update level, which means the latest cumulative update.
  • The index after the last colon is the edition you run, not the first one in the file.

Once DISM reports the restore operation completed, run sfc /scannow again so SFC can replace the files it could not fix the first time. That second pass is Microsoft’s own order: DISM fixes the store, then SFC copies good files from it.

When does chkdsk actually fix anything?

chkdsk fixes errors only with /f, /r, /x or /b; run bare, it only reports status. On the system drive the volume is in use, so /f asks to schedule the check for the next restart. The online path avoids most of that downtime on NTFS:

chkdsk C: /scan

The scan repairs what it can online. Add /forceofflinefix to the scan to queue every defect for offline repair instead, and chkdsk C: /spotfix then fixes only those spots at the next restart, a much shorter outage than a full /f pass. The difference matters most on a server: /f on C: means a restart and a check that runs before anyone can log in, with the machine down for as long as the whole volume takes to walk, while /scan plus /spotfix keeps the volume in service and limits the offline part to the defects the scan already found. Pick the switch by the outage you can afford:

  • No downtime at all: chkdsk C: /scan, which reports and repairs online.
  • A short restart: /scan /forceofflinefix, then /spotfix.
  • A planned window: /f for logical errors on the whole volume.
  • Suspected bad sectors: /r, which does everything /f does, then reads every sector and can run for hours.

On a failing disk, copy the data off before /r: reading every sector puts more load on a drive that is already dying.

How do you fix a Windows PC that will not boot?

Boot the installation media, choose Repair your computer, then Troubleshoot and Command Prompt (or press Shift+F10 on the setup screen). In the recovery environment the Windows drive is not always C:, so check it with dir C:\Windows first. Scan for installs and restart to test; if that does not fix it, back up the BCD store, move it aside and rebuild it, as Microsoft’s boot troubleshooting guide does for a BIOS disk:

bootrec /scanos
bcdedit /export C:\bcdbackup
attrib C:\boot\bcd -r -s -h
ren C:\boot\bcd bcd.old
bootrec /rebuildbcd

On a UEFI machine the BCD lives on the EFI system partition, not in C:\boot, and recreating the boot files with bcdboot is the cleaner fix. Microsoft’s own system partition repair is the plain form, which copies a fresh Windows Boot Manager into the EFI system partition and adds the firmware boot entry:

bcdboot C:\Windows

When you have to target the partition by hand, mount it as S: with mountvol S: /s and pass /s:

bcdboot C:\Windows /s S: /f UEFI

The /f option requires /s, and with /s bcdboot creates no firmware (NVRAM) entry: the machine then boots from the default \efi\boot\bootx64.efi path. The plain form puts Windows Boot Manager first in the boot order unless you add /p or /addlast.

On UEFI, bootrec /fixboot often returns “Access is denied”, another reason to reach for bcdboot. The Startup Repair log, if you tried that first, is in %windir%\System32\LogFiles\Srt\SrtTrail.txt.

How do you check the recovery environment with reagentc?

Windows RE is the menu a PC falls into after failed boots, and every boot fix above depends on reaching it. Run reagentc /info and read two lines of its output:

  • Windows RE status: Enabled or Disabled.
  • Windows RE location: the disk and partition that hold Winre.wim, empty when it is disabled.

If it shows disabled, reagentc /enable turns it back on using the default Winre.wim from \Windows\System32\Recovery. From a running Windows, reagentc /boottore boots straight into it on the next restart, which is the fastest way to reach the recovery command prompt on a VM or a server with no boot menu key.

For the wider set of everyday commands, the Windows CMD commands cheat sheet covers diskpart, netsh and ipconfig, and the Windows event IDs cheat sheet helps you find the disk and service errors that send you here. If setup keeps asking for media, the fix for the could not find the recovery environment error starts with the same reagentc check. Microsoft’s Repair a Windows Image page is the reference for every DISM switch above.

Keep reading

Claude Code Cheat Sheet: Commands, Shortcuts and Flags (PDF) AI Claude Code Cheat Sheet: Commands, Shortcuts and Flags (PDF) OpenAI Codex CLI Cheat Sheet: Shortcuts, Commands, Flags (PDF) AI OpenAI Codex CLI Cheat Sheet: Shortcuts, Commands, Flags (PDF) Linux and DevOps Cheat Sheets (Free PDF Pack) Cheat Sheets Linux and DevOps Cheat Sheets (Free PDF Pack) Install Grok Build on Windows 11 (Formerly Cursor) AI Install Grok Build on Windows 11 (Formerly Cursor) netsh Commands Cheat Sheet: Wi-Fi, Firewall, Port Proxy (PDF) Cheat Sheets netsh Commands Cheat Sheet: Wi-Fi, Firewall, Port Proxy (PDF) Install Active Directory Domain Services on Windows Server 2025 Windows Install Active Directory Domain Services on Windows Server 2025

Leave a Comment

Press ESC to close