This guide explains how to check and fix system errors on Windows using the command line tools. We'll cover the necessary commands and steps to identify and resolve common issues.
- Open Command Prompt as Administrator: Press Windows + X → select Command Prompt (Admin) or Windows Terminal (Admin).
- Run the following.
sfc /scannow
- Wait until the scan completes. Do not close the window during the process.
The DISM tool repairs the Windows system image and component store.
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth
-
/CheckHealth – Quickly checks for known corruption.
-
/ScanHealth – Performs a deeper scan for problems.
-
/RestoreHealth – Repairs the image using Windows Update or a specified source.
- Open terminal as Administrator.
- Run the following
DISM /Online /Cleanup-Image /RestoreHealth
- Then run
sfc /scannow
Instead of running each command manually, you can use the included RepairWindows.bat to automate the full repair sequence.
- Auto-elevates to Administrator — double-clicking the file will automatically trigger a UAC prompt. No need to right-click and select "Run as Administrator".
- Runs all 4 repair steps in sequence — DISM CheckHealth, ScanHealth, RestoreHealth, then SFC.
- Summary report — after all steps complete, a formatted report is shown in the terminal with a
[PASS],[WARN],[DONE], or[FAIL]status for each step. - Stays open until dismissed — the window remains open after the report so you can review the results. Press Enter to close.
- Double-click
RepairWindows.bat. - Click Yes on the UAC (User Account Control) prompt to allow administrator access.
- Wait for all steps to complete — this may take several minutes.
- Review the Repair Summary Report displayed at the end.
- Press Enter to close the window.
| Status | Meaning |
|---|---|
[PASS] |
Step completed successfully with no issues |
[WARN] |
Issues were detected (review DISM output above) |
[DONE] |
SFC found and repaired integrity violations |
[FAIL] |
Step failed — check the error code and logs above |
-
These tools are built into Windows and safe to use.
-
Requires an internet connection for DISM if using Windows Update as the repair source.
-
You can use these commands to fix issues like:
- Missing/corrupt system files
- Random crashes or BSODs
- Windows Update problems