The Windows Command Prompt (CMD) is an incredibly powerful tool for troubleshooting and repairing system issues. Whether your PC is slow, unresponsive, or failing to boot, CMD can help fix corrupted files, repair the hard drive, and restore system functionality.
In this article, we will explore 16 essential CMD commands for system repair. In addition, we will also provide step-by-step instructions, and additional troubleshooting tips to ensure you can confidently restore your computer.

16 Effective Command Prompts for System Repair
1. Open Command Prompt as an Administrator
Many system repair commands require elevated privileges to modify critical Windows files. Running CMD without administrator access may prevent certain commands from executing properly.
How to Open CMD as Administrator:
- Press Windows + S to open the search bar.
- Type
cmd
, and right-click on “Command Prompt.” - Select Run as administrator from the menu.
- If prompted by User Account Control (UAC), click Yes to proceed.
💡 Tip: If Windows won’t boot, access CMD via the Advanced Startup Options:
- Restart your PC while holding Shift and select Troubleshoot > Advanced options > Command Prompt.
2. Scan and Repair System Files (SFC Command)
The System File Checker (SFC) scans Windows system files for corruption and automatically replaces damaged or missing files.
How to Run an SFC Scan:
- Open Command Prompt as Administrator.
- Type the following command and press Enter:
sfc /scannow
- Wait for the scan to complete (this may take 10-15 minutes).
- If errors are found and repaired, restart your PC.
Troubleshooting SFC Issues:
- If SFC finds issues but cannot fix them, try running it in Safe Mode or use the DISM command (next section).
- Running the scan twice can sometimes fix errors not resolved in the first attempt.
✅ Best for fixing:
- Missing DLL files
- Crashes or Blue Screen of Death (BSOD)
- Windows Explorer errors
3. Repair Windows Image (DISM Command)
The Deployment Image Servicing and Management (DISM) tool is used when SFC fails to repair system files. It fixes deeper system corruption by restoring Windows images.
Commands to Run:
- Check for corruption:
DISM /Online /Cleanup-Image /ScanHealth
- Fix any detected corruption:
DISM /Online /Cleanup-Image /RestoreHealth
- Restart your PC after the process is completed.
When Should You Use DISM?
- If Windows functions aren’t working properly (e.g., Start Menu issues).
- If SFC reports unfixable errors.
- After major Windows updates to refresh the system image.
✅ Works best for:
- Corrupt system files that SFC cannot fix
- Windows update failures
4. Fix Hard Drive Errors (CHKDSK Command)
The Check Disk (CHKDSK) command scans and repairs hard drive issues like bad sectors, lost clusters, and directory errors.
How to Use CHKDSK:
- Open Command Prompt as Administrator.
- Type the following command and press Enter:
chkdsk C: /f /r
/f
Fixes file system errors./r
Locates and recovers bad sectors.
- If your drive is in use, CMD will ask you to schedule the scan for the next restart. Type Y and press Enter.
- Restart your PC to let CHKDSK scan and repair issues.
💡 Important: CHKDSK may take hours if the drive is large.
✅ Best for:
- Fixing hard drive corruption
- Repairing bad sectors
- Improving system performance
5. Check and Repair Boot Issues (BOOTREC Command)
If your PC fails to start, BOOTREC can repair boot issues by fixing the Master Boot Record (MBR), Boot Sector, and Boot Configuration Data (BCD).
Boot Repair Commands:
bootrec /fixmbr (Repairs the Master Boot Record)
bootrec /fixboot (Writes a new boot sector)
bootrec /scanos (Scans for Windows installations)
bootrec /rebuildbcd (Rebuilds Boot Configuration Data)
Steps to Use BOOTREC:
- Boot into Windows Recovery Mode:
- Restart and hold Shift + F8 or use a Windows installation USB/DVD.
- Select Advanced Options > Command Prompt.
- Run the BOOTREC commands above.
✅ Best for fixing:
- “Operating System Not Found” errors
- Black screen at startup
- Boot loops

6. Restore Previous System Settings (System Restore Command)
If a recent update or software installation caused problems, System Restore can roll back Windows to a previous working state.
How to Perform a System Restore via CMD:
- Open CMD as Administrator.
- Type:
rstrui.exe
- Follow the System Restore wizard to choose a restore point.
Important Notes:
- This won’t delete personal files, but it may remove recently installed apps.
- If Windows doesn’t boot, use Safe Mode or boot from a recovery USB.
✅ Best for fixing:
- Issues caused by driver updates
- Startup failures after a Windows update
7. Reset Network Settings (NETSH Command)
If your Wi-Fi or Ethernet isn’t working, resetting network settings can resolve connection issues.
Commands to Run:
netsh winsock reset
netsh int ip reset
When to Use This?
- If you’re getting “No Internet” errors.
- When websites fail to load properly.
✅ Best for:
- Resetting corrupt network settings
- Fixing slow internet speeds
8. Release and Renew IP Address (IPCONFIG Command)
A new IP address can fix network conflicts.
Commands to Run:
ipconfig /release
ipconfig /renew
✅ Best for fixing:
- Network connectivity issues
- Slow or intermittent internet
9. Flush DNS Cache (IPCONFIG Command)
If websites aren’t loading properly, clearing the DNS cache can help.
Command:
ipconfig /flushdns
✅ Best for:
- Fixing website loading issues
- Preventing DNS errors
10. Enable Safe Mode from CMD (bcdedit Command)
Safe Mode is a troubleshooting environment that runs Windows with only the essential drivers and services. It is useful for diagnosing software conflicts, driver issues, and malware infections.
How to Enable Safe Mode Using CMD?
- Open Command Prompt as Administrator.
- Type the following command and press Enter:
bcdedit /set {current} safeboot minimal
- Restart your PC. Windows will now boot into Safe Mode.
Additional Safe Mode Options:
- If you need Safe Mode with Networking (to access the internet):
bcdedit /set {current} safeboot network
- If you need Safe Mode with Command Prompt (without the Windows interface):
bcdedit /set {current} safeboot minimal bcdedit /set {current} safebootalternateshell yes
How to Exit Safe Mode?
Once you’re done troubleshooting, you can disable Safe Mode with this command:
bcdedit /deletevalue {current} safeboot
Then restart your computer.
✅ Best for fixing:
- PCs that crash on startup
- Malware removal
- Driver conflicts
11. Check CPU and Memory Usage (TASKLIST Command)
If your PC is running slowly, freezing, or overheating, you may have programs using too much CPU or RAM. The TASKLIST command shows all running processes, allowing you to identify resource-hungry applications.
How to Use TASKLIST?
- Open CMD as Administrator.
- Type:
tasklist
- You will see a list of running processes, including their memory and CPU usage.
Finding High Resource Usage Apps:
- Look for programs consuming high memory (above 500,000 K) or high CPU (above 20%).
- If a process looks suspicious, search its name online to see if it’s malware.
✅ Best for:
- Diagnosing high CPU/RAM usage
- Finding background apps slowing down your PC
12. Force-Close Unresponsive Apps (TASKKILL Command)
If an application freezes and won’t close, the TASKKILL command force-closes it without restarting your PC.
How to Use TASKKILL?
- First, find the app’s process name using TASKLIST:
tasklist
- Identify the process name or ID (PID) of the app you want to close.
- Force-close the app using:
taskkill /im application.exe /f
Or, if using the Process ID (PID):
taskkill /pid 1234 /f
✅ Best for fixing:
- Frozen or unresponsive programs
- Apps causing high CPU/RAM usage
13. Fix Windows Update Issues (Reset Update Components)
Windows updates can fail or get stuck due to corrupt update files, missing system components, or interrupted downloads.
How to Reset Windows Update Using CMD?
- Open CMD as Administrator.
- Stop the update services:
net stop wuauserv net stop bits net stop cryptsvc
- Delete old update files:
del %systemroot%\SoftwareDistribution /Q /S del %systemroot%\System32\catroot2 /Q /S
- Restart the services:
net start wuauserv net start bits net start cryptsvc
- Restart your PC and try updating Windows again.
✅ Best for fixing:
- Stuck Windows updates
- Windows update errors (e.g., Error 0x80070057, 0x800f081f)
14. Scan for Malware (MRT Command)
Windows includes a built-in Malicious Software Removal Tool (MRT) that scans for common malware infections.
How to Run a Malware Scan Using CMD?
- Open CMD as Administrator.
- Type:
mrt
- The Microsoft Malicious Software Removal Tool will open.
- Select Full Scan and follow the on-screen instructions.
💡 Tip: If malware persists, boot into Safe Mode and run the scan again.
✅ Best for fixing:
- Virus infections
- Spyware and malware attacks
15. List Installed Drivers (DRIVERQUERY Command)
If your PC is crashing or devices aren’t working, a faulty driver may be the cause. The DRIVERQUERY command lists all installed drivers and their status.
How to Check Installed Drivers?
- Open CMD as Administrator.
- Type:
driverquery
- Look for outdated or missing drivers.
- To get detailed info, use:
driverquery /V
What to Do Next?
- If a driver is outdated, update it via Device Manager.
- If a driver is causing crashes, use Safe Mode to uninstall it.
✅ Best for:
- Troubleshooting driver issues
- Fixing Blue Screen (BSOD) errors
16. Reset Windows Without Losing Files (System Reset Command)
If nothing else works, resetting Windows reinstalls the operating system while keeping your files.
How to Reset Windows Using CMD?
- Open CMD as Administrator.
- Type:
systemreset -cleanpc
- Follow the on-screen instructions.
- Choose Keep My Files to retain personal data while resetting Windows.
💡 Tip: If CMD doesn’t open, try resetting from Advanced Startup (Shift + Restart).
✅ Best for fixing:
- Severe system corruption
- Unfixable crashes and boot issues

Practical Scenarios of Command Prompts for System Repair
1. Fixing a Slow Computer
Your computer has been getting progressively slower, and you suspect there may be something wrong with system files, the hard drive, or other settings.
How CMD Helps:
- SFC (System File Checker) and CHKDSK (Check Disk) are invaluable when dealing with slow system performance caused by corrupted files or bad sectors on your hard drive.
- TASKLIST and TASKKILL can help you identify and force-close programs that are consuming excessive CPU or RAM.
Practical Steps:
- Run the SFC /scannow command to check for corrupted system files.
- Run CHKDSK /f /r to check the disk for bad sectors and repair any errors.
- Use TASKLIST to identify resource-hungry programs and TASKKILL to shut them down.
Before you run the CHKDSK command, backup important files in case the scan finds serious hard drive issues. Also, consider running these checks in Safe Mode to prevent third-party software from interfering.
2. Fixing Boot Problems or Startup Crashes
Your computer fails to boot up properly and shows an error such as “Operating System Not Found” or “Boot Manager is Missing.”
In this case, the BOOTREC command can be a lifesaver. The Master Boot Record (MBR) or Boot Configuration Data (BCD) might be corrupted, which is why your computer isn’t booting.
Practical Steps:
- Boot into Advanced Startup Options using a Windows recovery disk or by pressing Shift + Restart.
- Go to Troubleshoot > Advanced Options > Command Prompt.
- Run these commands:
bootrec /fixmbr bootrec /fixboot bootrec /rebuildbcd
- Restart your computer.
If you continue to experience issues, use SFC /scannow after fixing the boot errors to ensure that system files are intact. Running DISM to restore the system image can also help if SFC doesn’t fix the problem.
3. Troubleshooting Network Connectivity Issues
Your computer is not connecting to the internet, even though other devices on the same network work fine. You’ve tried restarting the router, but the issue persists.
The NETSH and IPCONFIG commands are incredibly useful for fixing network-related problems. You can reset network settings or release and renew your IP address to resolve issues caused by misconfigured network settings.
Practical Steps:
- Open CMD as Administrator.
- Use the following commands:
netsh winsock reset netsh int ip reset
- After that, release and renew your IP address:
ipconfig /release ipconfig /renew
- Finally, flush the DNS cache:
ipconfig /flushdns
If your computer still cannot connect to Wi-Fi, make sure the Wi-Fi driver is up-to-date and that the network settings are configured correctly.
4. Fixing Malware or Suspicious Activity
You notice your computer is running unusually slow, there are pop-up ads, and files are disappearing. You suspect a malware infection.
The Microsoft Malicious Software Removal Tool (MRT) and other built-in scanning tools can help detect and remove malware.
Practical Steps:
- Open CMD as Administrator.
- Run the MRT command:
mrt
- Choose Full Scan and allow the tool to detect and remove any malware.
- For further protection, download a trusted antivirus tool to perform a more in-depth scan.
Always boot into Safe Mode before running a malware scan. This will prevent malware from starting up with Windows, allowing the antivirus to work more effectively.
5. System Restore Without a GUI
Your system has encountered serious issues such as corrupt drivers or faulty software, and you want to restore your system to a previous point. However, you can’t access the System Restore option from the graphical user interface (GUI).
You can run System Restore directly from CMD by using the rstrui.exe command, even when your system is not responding properly.
Practical Steps:
- Boot into Advanced Startup Options or use the recovery drive.
- Select Troubleshoot > Advanced Options > Command Prompt.
- Type the following command:
rstrui.exe
- Follow the prompts to restore your system to a previous point.
Ensure you have System Restore enabled before problems occur so you have restore points to go back to. You can check this under Control Panel > System > System Protection.
6. Fixing Windows Update Errors
Windows updates keep failing, and you can’t seem to install the latest patches. You’ve tried everything, but the update process always fails, and the system shows an error code.
Running Windows Update troubleshooter commands through CMD can reset update components and fix any stuck updates.
Practical Steps:
- Open CMD as Administrator.
- Stop Windows update services:
net stop wuauserv net stop bits net stop cryptsvc
- Delete corrupt update files:
del %systemroot%\SoftwareDistribution\* /f /s del %systemroot%\System32\catroot2\* /f /s
- Restart the update services:
net start wuauserv net start bits net start cryptsvc
- Check for updates again.
If updates continue to fail, try using the DISM command to fix the Windows image before attempting another update.
7. Resetting Windows Without Losing Files
Your system is so corrupted that even after troubleshooting, it’s still not functioning properly. You want to reset Windows without losing your personal files.
You can initiate a Windows reset using CMD, which reinstalls Windows but allows you to keep your files intact.
Practical Steps:
- Open CMD as Administrator.
- Run the following command to reset Windows:
systemreset -cleanpc
- Follow the on-screen instructions to reset your computer and choose Keep My Files.
This option removes installed apps and resets all system settings. Be sure to back up your important data before starting.
8. Identify and Uninstall Problematic Drivers
After a recent Windows update or hardware installation, your system has started to crash or display the Blue Screen of Death (BSOD). The issue might be with a driver that’s either outdated or incompatible.
You can list installed drivers and their status using the driverquery command and update or uninstall problematic drivers directly from Device Manager or with PNPUTIL.
Practical Steps:
- Open CMD as Administrator.
- Type:
driverquery
- If you spot a problematic driver, uninstall it using Device Manager or the following command:
pnputil /delete-driver <driver_name> /force
After removing a faulty driver, restart your system and install the latest driver from the device manufacturer’s website.
Final Tips for Using Command Prompt for System Repair
- Always run CMD as an administrator: Many repair commands need elevated privileges to make changes to the system.
- Create a system backup: Before running commands like CHKDSK or System Restore, always back up important files. You can use File History or third-party backup solutions.
- Be patient: Some repair processes, especially CHKDSK and DISM, can take a while to complete, depending on your system’s condition and hard drive size.
- Research error codes: If a command gives an error, take note of the code and search for it online to find specific fixes.