Windows acting up? Before you consider a clean reinstall, there are three powerful command-line tools that can fix most system file corruption issues. These tools—CHKDSK, SFC, and DISM—work together to repair everything from disk errors to corrupted Windows components.
Why Windows Gets Corrupted
System file corruption typically stems from two main causes:
Hardware Issues
Hard drives don’t last forever. Traditional HDDs develop bad sectors over time, while SSDs have limited write cycles. Either can cause data corruption that manifests as Windows instability.
Signs of hardware-related corruption:
- Random blue screens (BSOD)
- Applications crashing unexpectedly
- Files becoming unreadable
- Windows freezing during boot
Interrupted Updates
Windows Update modifies critical system files. If that process gets interrupted—power outage, forced shutdown, battery death on a laptop—the system can be left in an inconsistent state. Some files are updated, others aren’t, and Windows doesn’t know what to trust.
Common symptoms:
- Update failures that repeat
- Windows Update stuck in a loop
- Features or applications that suddenly stop working
- Error messages referencing missing or corrupted files
The Three-Step Repair Process
For best results, run these tools in order. Each step prepares the system for the next.
Step 1: CHKDSK (Check Disk)
CHKDSK examines your hard drive for file system errors and bad sectors. It can repair logical file system issues and mark bad sectors so Windows avoids them.
Open Command Prompt as Administrator and run:
chkdsk /f /r /x
Parameters explained:
/f- Fixes errors on the disk/r- Locates bad sectors and recovers readable information/x- Forces the volume to dismount first (if necessary)
Important: If running on your system drive (usually C:), Windows will ask to schedule the check for the next restart. Type Y and reboot—CHKDSK needs exclusive access to the drive.
How long it takes: Depends on drive size and condition. Expect 30 minutes to several hours for large or damaged drives.
Step 2: SFC (System File Checker)
SFC scans Windows system files and replaces corrupted ones with clean copies from the Windows component store.
Run as Administrator:
sfc /scannow
What to expect:
The scan takes 10-30 minutes. You’ll see one of these results:
- “Windows Resource Protection did not find any integrity violations” - Your system files are fine
- “Windows Resource Protection found corrupt files and successfully repaired them” - Issues found and fixed
- “Windows Resource Protection found corrupt files but was unable to fix some of them” - The component store itself may be corrupted (proceed to Step 3)
If SFC can’t repair files: Check the log at C:\Windows\Logs\CBS\CBS.log for details on what failed.
Step 3: DISM (Deployment Image Servicing and Management)
DISM repairs the Windows component store—the source that SFC uses to fix corrupted files. If SFC reports it can’t repair something, DISM is often the solution.
Run as Administrator:
DISM /Online /Cleanup-Image /RestoreHealth
What this does:
/Online- Targets the running Windows installation/Cleanup-Image- Specifies image cleanup operations/RestoreHealth- Scans for corruption and repairs using Windows Update
Requires internet connection: DISM downloads replacement components from Windows Update. If you’re offline, you can use a Windows installation ISO as a source instead.
How long it takes: 15-45 minutes typically, but can take longer on slow connections or heavily damaged systems. The progress bar often stalls at 20% or other points—this is normal. Don’t interrupt it.
After DISM: Run SFC Again
Once DISM completes successfully, run SFC one more time:
sfc /scannow
This ensures that any files SFC couldn’t repair previously are now fixed using the restored component store.
Running from Recovery Environment
If Windows won’t boot normally, you can run these tools from Windows Recovery:
- Boot from Windows installation media
- Select “Repair your computer”
- Navigate to Troubleshoot > Advanced options > Command Prompt
From recovery, the commands need to target the correct drive (it might not be C:):
chkdsk /f /r D:
sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows
DISM /Image:D:\ /Cleanup-Image /RestoreHealth
(Replace D: with whatever drive letter Windows is on in the recovery environment)
Troubleshooting Common Issues
DISM Error 87
This usually means a typo in the command. The most common mistakes:
- Using dashes instead of forward slashes
- Missing spaces between parameters
- Misspelling Cleanup-Image or RestoreHealth
Copy-paste the command exactly:
DISM /Online /Cleanup-Image /RestoreHealth
DISM Stuck at 20%
The progress indicator isn’t linear. DISM often sits at 20% (or 40%, or other points) while processing large operations. Let it run—interrupting can cause more problems. If it’s truly stuck for hours, try running from Safe Mode.
”Windows Resource Protection could not start the repair service”
This indicates the Windows Modules Installer service isn’t running. Fix it with:
net start trustedinstaller
Then retry SFC.
Using a Local Source for DISM
If you can’t connect to Windows Update, mount a Windows ISO and use it as a source:
DISM /Online /Cleanup-Image /RestoreHealth /Source:E:\Sources\install.wim
(Replace E: with your mounted ISO drive letter)
When These Tools Aren’t Enough
These three utilities fix most corruption issues, but they have limits:
- Hardware failure - If your drive is physically failing, no amount of software repair helps. Replace the drive.
- Severe corruption - Some damage is too extensive. An in-place upgrade (running Windows Setup while Windows is running) can repair the installation while preserving your files and programs.
- Malware damage - If corruption was caused by malware, repair the files first, then run comprehensive antivirus scans.
Preventive Measures
To avoid future corruption:
- Use a UPS or surge protector - Protect against power-related corruption
- Don’t force shutdown during updates - Let Windows finish
- Monitor drive health - Use tools like CrystalDiskInfo to catch failing drives early
- Keep backups - When all else fails, a recent backup is your best friend
These repair tools are powerful, but they’re not substitutes for proper backups and good system hygiene.