A comprehensive batch script for diagnosing and repairing Windows system issues. This tool provides an interactive menu-driven interface to execute various Windows system maintenance and repair commands.
- Quick Status Check: Rapid system image integrity verification
- Detailed System Scan: In-depth analysis of system image health
- System Image Repair: Automated repair of corrupted system files with Windows Update integration
- System File Checker: Comprehensive system file integrity verification and repair
- Windows Update Repair: Cache reset with confirmation, backups, and service recovery
- Sequential Repair Mode: DISM image repair followed by SFC, with failure checks
- Interactive Menu: User-friendly interface with detailed help section
- Windows Operating System (Windows 10/11 recommended)
- Administrator privileges
- Active internet connection (for system file downloads during repairs)
Paste into Windows PowerShell and approve the administrator prompt:
& { $p = "$env:TEMP\sys_repair.bat"; Invoke-WebRequest -UseBasicParsing -Uri 'https://raw.githubusercontent.com/Mohabdo21/Windows-Repair-Tool/main/sys_repair.bat' -OutFile $p -ErrorAction Stop; Start-Process -FilePath $p -Verb RunAs }Warning: Downloads and runs code from main as administrator. Only run if you trust this repository.
- Download the
sys_repair.batfile - Right-click the file and select "Run as administrator"
# Alternative: Launch from Command Prompt (Admin)
cd path/to/script
sys_repair.batThe script presents an interactive menu with the following options:
-
Quick Status Check (
DISM /CheckHealth)- Fast verification of system image integrity
- Recommended as first diagnostic step
-
Detailed Scan (
DISM /ScanHealth)- Thorough system image analysis
- May take several minutes to complete
-
Repair System Image (
DISM /RestoreHealth)- Attempts to repair corrupted system files
- Downloads replacement files if needed
- Can take 15-30 minutes depending on system state
-
System File Checker (
sfc /scannow)- Scans and repairs corrupted Windows system files
- Recommended after DISM repairs
-
System Update Repair
- Use after Windows Update troubleshooting has failed
- Requests confirmation before resetting update caches
- Backs up cache folders and attempts service recovery on failure
- Does not change proxies, drivers, or service startup settings
-
Repair image, then system files
- Runs
DISM /RestoreHealth, thensfc /scannowafter successful image repair - Stops if DISM fails or requires a restart before continuing
- Does not include Windows Update repair operations
- Runs
-
Restart System - Requests confirmation before restarting
-
Restart to firmware settings - Requests confirmation; requires firmware support
-
Help - Describes available operations
Press 0 to exit and return to the calling terminal.
- Always backup important data before running system repairs
- Requires administrator privileges to execute repairs
- Save your work before confirming a restart
- Windows Update repair temporarily stops update services and retains cache backups
- Internet connection required for downloading system files during repair
- The sequential repair mode follows Microsoft's recommended execution order for optimal results
The script performs the following technical operations:
- DISM RestoreHealth: Repairs Windows component store using Windows Update
- SFC scannow: Verifies and repairs individual system files
DISM /CheckHealth and /ScanHealth remain separate diagnostic options.
- Service management (stop/start) for:
- Background Intelligent Transfer Service (BITS)
- Windows Update Service
- Cryptographic Services
- Cache folder backups with unique names
- Command-result checks and service recovery attempts on failure
The sequential repair mode follows Microsoft's recommended order:
- DISM /RestoreHealth - Repairs the Windows component store
- sfc /scannow - Runs after successful image repair
If DISM fails or requires a restart, resolve that condition before running SFC.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter issues:
- Ensure you're running as administrator
- Check internet connectivity for file downloads
- Verify Windows Update service is accessible
- Check system drive for sufficient space (at least 2GB free recommended)
- Review logs in
%windir%\Logs\DISM\dism.log- Also review the per-run log path printed by the script
- Exported
[SR]entries include historical SFC details, not just current-run errors
- If sequential repairs don't resolve issues, try running individual commands separately
- For persistent corruption, consider Windows in-place upgrade or system restore