Fix and Repair Windows 11 Using DISM and SFC Commands (Complete Script)

Fix and Repair Windows 11 Using DISM and SFC Commands (Complete Script)

If your Windows 11 PC is slow, freezing, or showing errors, it might have corrupted system files. The easiest way to fix this without reinstalling Windows is to use DISM (Deployment Image Servicing and Management) and SFC (System File Checker) together.

Hereโ€™s a single, combined script that performs all checks, scans, and repairs automatically โ€” step by step.


Full Repair Script (Run as Administrator)

Copy and paste this entire script into Command Prompt (Admin) or PowerShell (Admin):

@echo off
echo ===============================================
echo  Windows 11 Repair Script using DISM and SFC
echo ===============================================
echo.
echo Step 1: Checking Windows image health...
DISM /Online /Cleanup-Image /CheckHealth
echo.
echo Step 2: Scanning Windows image for problems...
DISM /Online /Cleanup-Image /ScanHealth
echo.
echo Step 3: Repairing Windows image (this may take a while)...
DISM /Online /Cleanup-Image /RestoreHealth
echo.
echo Step 4: Running System File Checker (SFC) to verify repairs...
sfc /scannow
echo.
echo ===============================================
echo  All operations complete.
echo  If issues were found and repaired, please restart your PC.
echo ===============================================
pause

How to Use This Script

  1. Save the Script
    • Open Notepad.
    • Paste the above script into it.
    • Click File > Save As.
    • Name it RepairWindows11.cmd.
    • Choose Save as type: All Files, then click Save.
  2. Run as Administrator
    • Right-click the saved file.
    • Select Run as administrator.
    • Allow the User Account Control (UAC) prompt.
  3. Wait for the Commands to Finish
    • The script will automatically check, scan, repair, and verify your Windows installation.
    • The process can take anywhere from 30 minutes to an hour, depending on your system speed and network connection.
  4. Restart Your PC
    • Once the script finishes, press any key to close the window.
    • Restart your computer to apply all fixes.

Offline Repair Option (Optional)

If your PC isnโ€™t connected to the internet, you can modify the RestoreHealth command to use an offline Windows source.
Insert a Windows 11 USB or mount an ISO, then replace the third DISM line in the script with:

DISM /Online /Cleanup-Image /RestoreHealth /Source:D:\Sources\install.wim /LimitAccess

Change D: to match your installation media drive letter.


What Each Command Does

CommandPurpose
DISM /Online /Cleanup-Image /CheckHealthChecks if Windows image has known corruption.
DISM /Online /Cleanup-Image /ScanHealthScans for deeper issues in the Windows image.
DISM /Online /Cleanup-Image /RestoreHealthRepairs the system image by downloading or using local files.
sfc /scannowScans and replaces corrupted system files using the repaired image.

Tips and Best Practices

  • Always run Command Prompt or PowerShell as Administrator.
  • Keep your internet connection stable if using online repair.
  • Donโ€™t interrupt the process โ€” wait until it says โ€œThe operation completed successfully.โ€
  • Check logs for detailed reports:
    • DISM logs: C:\Windows\Logs\DISM\dism.log
    • SFC logs: C:\Windows\Logs\CBS\CBS.log

If problems persist after running this script, consider performing an in-place upgrade using a Windows 11 ISO to refresh the system while keeping your files and apps.


SEO Details

Title: Fix and Repair Windows 11 Using DISM and SFC Commands (Complete Script)
Meta Description: Run this all-in-one DISM and SFC repair script to fix corrupted system files in Windows 11. Includes offline repair, logs, and step-by-step usage instructions.
Tags: Windows 11, DISM, SFC, Repair Script, Command Prompt, PowerShell, Windows Repair, Troubleshooting, System File Checker, Microsoft Tools


This all-in-one script provides a clean, automated way to repair Windows 11 โ€” scanning for corruption, repairing damaged files, and restoring system integrity, all with a single command execution.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top