The best commands to diagnose and repair problems in Windows 11

Last update: May 13th 2026
  • Use CMD/PowerShell as administrator for deep diagnostics and repairs that the interface does not offer, especially SFC/DISM and CHKDSK.
  • SFC repairs protected files; if it fails, DISM repairs the Windows image and then runs SFC again.
  • For disk problems, use CHKDSK; it includes the /fy and /ry options and may request a restart to complete repairs.
  • Network and connectivity: ipconfig, netsh, ping, and tracert allow you to clear cache, renew IP, and locate network outages.

Commands to repair problems in Windows 11

The command line remains a Swiss Army knife for diagnosing and repairing problems in Windows 11 without unnecessary hassle . Although the graphical interface has improved significantly, some issues are resolved faster, with more control, and with better results using commands. If your PC is slow, the network is failing, you're getting blue screens, or you suspect corrupted files, here's a practical and comprehensive guide.

This article compiles and organizes the key commands recommended by leading technical guides and official support , explaining when to use each one, safe steps, messages you might encounter, advanced options (such as repairing the Windows image without an internet connection), and useful shortcuts. Furthermore, you can easily run many of them from a .bat file in Windows 10 or 11 , which is perfect for automating routine maintenance.

When to use the command line to fix problems in Windows 11?

Use CMD or PowerShell as an administrator when you need in-depth system diagnostics, automation, or repair . Commands can access functions that aren't always available through the interface, and their feedback is clearer, allowing you to understand exactly what's happening.

General rule : If you suspect system file or Windows image problems, start with SFC and DISM; if you suspect disk or file system failures, use CHKDSK; and if the problem is with the network, run ipconfig, netsh, ping, and tracert.

The 3 essential tools for troubleshooting Windows 11: CHKDSK, SFC, and DISM

CHKDSK: Checks and repairs the disk

CHKDSK (Check Disk) analyzes and repairs file system errors and bad sectors . It is ideal when you experience slowness, freezes, problems opening files, or suspect physical/logical damage to the drive.

If you scan the system drive, it may ask for a reboot to complete the repair.. Do not interrupt the process. In NTFS there are useful parameters such as /scan/spotfix o /perf which allow for optimizing online or ad hoc analysis.

  How to optimize an SSD in Windows 11 for truly lightning-fast performance

How to use basic commands to fix problems in Windows 11

SFC: Check and restore system files

System File Checker (SFC) verifies the integrity of protected Windows files and automatically repairs them . Use it if you see missing DLLs, system errors, unresponsive functions, or recurring blue screens.

  1. Open CMD as administrator and runs: sfc /scannow.
  2. Wait for the resultTypical messages: Repaired successfully; no violations were detected; or some files could not be repaired.

Useful parameters/verifyonly (just check), /scanfile y /verifyfile (on specific routes), and options /offbootdir/offwindir y /offlogfile for offline scenarios.

If SFC cannot repair, it proceeds to DISM . Often the problem lies in the Windows image that SFC uses to restore files.

DISM: Repairs the Windows image

DISM (Deployment Image Servicing and Management) corrects the Windows image that the system uses to repair itself . It is the "plan B" when SFC fails or continues to detect corruption.

  • quick diagnosisDISM /Online /Cleanup-Image /CheckHealth (confirm if there is damage).
  • Deep analysisDISM /Online /Cleanup-Image /ScanHealth (logs problems in detail).
  • RepairDISM /Online /Cleanup-Image /RestoreHealth (downloads healthy components, usually from Windows Update).

Recommended order: First /CheckHealth, then /ScanHealth and finally, /RestoreHealth, waiting for each step to complete. After restoring with DISM, run SFC again to leave the system in perfect condition.

No Internet or Windows Update failing? Use an ISO/USB as a source: find out the edition with This guide to repairing hardware and system components and repair with something like DISM /Online /Cleanup-Image /RestoreHealth /Source:G:\sources\install.wim:Index /LimitAccess replacing path and index with the correct ones.

Infallible network commands

If your internet connection is intermittent, DNS isn't resolving, or apps won't connect, start by clearing and refreshing your network settings . These are quick and very effective commands. For advanced network management...

  • ipconfig: Network information and DHCP and DNS management.
    • Renew IPipconfig /release & AFTER ipconfig /renew.
    • Flush DNS cacheipconfig /flushdns.
  • netsh winsock resetnetsh winsock reset resets the Winsock catalog and It usually fixes persistent outages and connectivity errors.. More details in the .
  • ping: Check connectivity and latency (for example, ping google.com).
  • tracert: Traces network hops to a destination (tracert google.com), useful for detecting where you cut.
  • netstat: shows active connections and ports (netstat), ideal for socket and traffic diagnostics.
  • getmac: list MAC addresses (getmac), useful in inventories and access control.

System inventory and process control

To understand what you're dealing with, it's helpful to list hardware, drivers, and processes . This will help you identify bottlenecks, problematic software, or outdated drivers. In advanced cases, you can also consult tools like msinfo32.

  • systeminfo: equipment and system specifications (systeminfo).
  • see: Windows version and build (ver), useful for validating compatibilities.
  • driverquery: list installed drivers (driverquery), perfect for audit drivers.
  • WMIC: Classic administration interface. Example: wmic cpu get name to identify the CPU.
  • tasklist: active processes (tasklist), the “text view” of the Task Manager.
  • taskkill: closes problematic processes (taskkill /IM notepad.exe /F).
  How to open the Control Panel in Windows 11 step by step

Boot, power, and configuration

When the problem is related to startup, power, or system configuration, these commands give you the necessary control . Use them judiciously, especially the startup commands.

  • bcdedit: View and edit boot options (bcdedit), reserved for very specific changes.
  • shutdown: quick restart of the computer (shutdown /r), useful after configuration changes.
  • powercfg: manages power; for example, disable hibernation (powercfg /h off) to save disk space.
  • gpupdate: refresh group policies (gpupdate /force), key after policy changes.
  • msconfig: Open System Configuration (run msconfig from search), ideal for selective starting.

Disks, files and associations

Managing partitions, repairing file systems, and checking file type associations are also part of the diagnostic process . This involves using utilities that should be used with caution.

  • diskpart: Create, delete, and format partitions. It is powerful and can erase data if you make a mistake; use it only if you know exactly what you're doing.
  • Assoc: query and modify associations between extensions and programs (assoc), useful if a file type opens with the wrong app.
  • help: list of available commands and syntax (help), perfect for remember parameters at the moment.

Services and system status

Some errors are caused by stopped or blocked services . Before reinstalling anything, check if the service involved is working correctly:

  • sc query: query the status of a service (sc query wuauserv for Windows Update).
  • net start y net stop: starts or stops services (net start wuauserv / net stop wuauserv), useful after update errors.

Users and manual replacement of system files

In addition to changing passwords, in extreme cases you can manually replace a corrupted system file . Make a backup first and be sure to use a reliable, healthy copy.

  • net user: change local passwords (net user NombreUsuario nueva_contraseña), for example: net user Vincent nueva_contraseña.

If SFC/DISM fails to repair a specific file, you can manually replace it by taking ownership, granting permissions, and copying the clean file : see advanced cases.

  1. Take possessiontakeown /f C:\Windows\System32\jscript.dll (replace the path with the path of the damaged file).
  2. Give full control to administratorsicacls C:\Windows\System32\jscript.dll /grant administrators:F (in Spanish systems it may be administradores:F).
  3. Copy the healthy filecopy E:\temp\jscript.dll C:\Windows\System32\jscript.dll (set origin/destination).
  How to use the Play Store on your PC: emulators, Google Play Games, and more

After replacing the part, restart your system and check if the problem is resolved . You can also consult [link to relevant documentation].

.bat script for quick maintenance

If you prefer to automate maintenance, create a .bat with the key commands. Open Notepad, paste lines like DISM /Online /Cleanup-Image /RestoreHealth y sfc /scannow, and even program chkdsk for the next time you reboot.

Save the file with the .bat extension, run it as administrator in Windows 10 or 11, and let the process run on its own . It's a simple way to standardize a "first aid kit."

Troubleshooters and when to reinstall

Windows 11 includes built-in troubleshooters that automatically detect and fix common problems . Go to Settings > System > Troubleshoot and try the troubleshooters for Windows Update, Network, Bluetooth, Video Playback, and more.

If problems persist despite CHKDSK/SFC/DISM and troubleshooters , consider reinstalling Windows when: the failures reappear over and over; there is serious malware; performance is terrible with frequent crashes; after a critical update everything became unstable; or you have changed key hardware such as the motherboard or hard drive.

Productivity tips and built-in help

To know the syntax of any command on the fly, add /? at the end (for example, sfc /?). You'll see parameters, descriptions, and examples without having to search elsewhere.

Remember to run CMD or PowerShell as administrator when the command requires it (SFC, DISM, CHKDSK with repair, netsh, services, etc.). This will prevent permission errors and save you time.

More useful commands to have on hand

  • ipconfig: already seen, but don't forget /all all with view all network settings.
  • Assoc- Check which app opens each extension and fix it if necessary.
  • help: list of available commands; combine it with comando /? for complete help.

This set of commands will cover diagnostics, repairs, and maintenance in Windows 11. Start with the basics (CHKDSK, SFC, DISM), use ipconfig/netsh for network management, tasklist/taskkill and systeminfo/driverquery to analyze the system, and finish with services, startup items, and, if necessary, manual file replacement or the built-in troubleshooters. This drastically reduces the need for reinstallation and leaves your computer running smoothly. Share this guide so more users can learn to repair problems in Windows 11.