Common Windows CMD Commands for Diagnosing and Repairing Computer Problems

Windows Administrator Command Prompt displaying system diagnostic commands and representative output

Windows Command Prompt can inspect system files, test network connectivity, review running processes, generate reports, and repair selected software problems. This is powerful as it provides direct access to administrative functions, but that power requires careful command selection.

This guide covers common commands for Windows 10 and Windows 11. Run only the commands that match the symptom. Only the command shown inside each code block should be used.

Open Command Prompt as Administrator

  1. Open the Start menu.
  2. Type cmd.
  3. Right-click Command Prompt.
  4. Select Run as administrator.
  5. Approve the User Account Control prompt.

Before starting:

  • Save open work.
  • Back up important files.
  • Connect a laptop to AC power.
  • Record custom network settings before running network resets.
  • Verify drive letters, disk numbers, volume sizes, and hardware models.
  • Read the command output before proceeding.

A blinking cursor is a patient question mark, not a diagnosis. The symptom should determine the command sequence.

Safety note: Commands must be verified before execution. Disk management, file-system repair, and recovery operations can cause data loss or make files inaccessible. When important data exists only on a questionable drive, data preservation should come before repair attempts.

DISM: Repair the Windows Component Store

Deployment Image Servicing and Management, commonly called DISM, repairs the Windows component store. This store contains the files Windows uses to service the operating system and provide replacement files for System File Checker.

Run these commands one at a time:

DISM.exe /Online /Cleanup-Image /CheckHealth

/CheckHealth performs a quick check for previously detected corruption.

DISM.exe /Online /Cleanup-Image /ScanHealth

/ScanHealth performs a more extensive scan. It can take considerably longer than /CheckHealth.

DISM.exe /Online /Cleanup-Image /RestoreHealth

/RestoreHealth attempts to repair the component store. Windows may use Windows Update as a repair source. If the local component store and Windows Update source are both unavailable or damaged, a matching Windows installation source may be required.

The usual order for damaged Windows system files is:

  1. Run DISM.exe /Online /Cleanup-Image /RestoreHealth.
  2. Wait for the command to finish.
  3. Run sfc.exe /scannow.

Do not close the window while DISM is working. Progress can appear to pause for a period of time.

DISM command demonstrated and explained

SFC: Check Protected Windows Files

System File Checker scans protected Windows files and replaces damaged versions when a valid replacement is available.

sfc.exe /scannow

The scan may take several minutes. Common results include:

  • Windows Resource Protection did not find any integrity violations: No protected-file problems were found.
  • Windows Resource Protection found corrupt files and successfully repaired them: Corruption was detected and repaired.
  • Windows Resource Protection found corrupt files but was unable to fix some of them: DISM may need to be run first, followed by another SFC scan.
  • Windows Resource Protection could not perform the requested operation: The scan may need to run in Safe Mode or from a recovery environment.

SFC can also check one protected file instead of scanning the entire system. The following examples use a real protected Windows file path:

sfc.exe /verifyfile=C:\Windows\System32\kernel32.dll

/verifyfile= checks the specified protected file without attempting a repair.

sfc.exe /scanfile=C:\Windows\System32\kernel32.dll

/scanfile= checks and attempts to repair the specified protected file.

The file path must be complete. These targeted commands are useful when a particular Windows file is named in an error message. They do not test every operating-system component.

CHKDSK: Check File-System Integrity

CHKDSK examines a volume for logical file-system errors. A logical error can involve directory information, file records, or the way free space is tracked. CHKDSK is not a general-purpose hardware repair tool.

A basic check that does not request repairs is:

chkdsk C:

For an NTFS system drive, an online scan is generally a useful first check:

chkdsk C: /scan

To fix logical file-system errors:

chkdsk C: /f

Windows may report that the volume is in use and offer to schedule the scan for the next restart. Type Y only when that restart-based operation is appropriate.

To locate bad sectors and attempt to recover readable information:

chkdsk C: /r

/r includes the function of /f, so /f /r is normally unnecessary. The /r operation can take a long time, especially on large hard disk drives.

To force a volume to dismount before checking:

chkdsk C: /x

/x includes /f. Dismounting a volume can interrupt access to files on that volume.

Do not begin with an extensive CHKDSK repair on a drive that is clicking, disappearing, unreadable, disconnecting, or rapidly failing. Repeated reads can place additional stress on failing hardware, while repairs can change file-system structures. When data preservation matters, imaging or recovery work should come first. CHKDSK repairs logical file-system problems; it does not cure a failing drive, damaged electronics, overheating, or a defective storage controller.

DiskPart: Inspect Disks and Volumes Carefully

DiskPart manages physical disks, partitions, and volumes. It is also one of the easiest Windows tools to misuse because commands apply to the currently selected object.

A non-destructive inspection sequence is:

diskpart
list disk
select disk N
detail disk
list partition
list volume
select volume N
detail volume
exit

Replace N with the correct disk or volume number. Verify the disk by size and model before selecting it. Disk number order can change when external drives, card readers, or additional storage devices are connected.

To assign a drive letter to the selected volume:

assign letter=E

To remove the letter from the selected volume:

remove letter=E

These commands do not normally erase the volume, but changing drive letters can affect shortcuts, scripts, applications, and software paths.

The following commands are destructive or can make existing data inaccessible. They should not be included in a casual repair sequence:

delete partition

Deletes the selected partition.

delete partition override

Forces deletion when normal restrictions prevent it. This can remove partitions that Windows would otherwise protect.

clean

Removes partition and volume information from the selected disk. Existing data may become inaccessible immediately.

create partition primary

Creates a primary partition in available unallocated space.

format fs=ntfs quick label=Data

Formats the selected volume as NTFS with the label Data. A quick format does not perform the same full surface operation as a standard format, but it still destroys normal file-system access to existing data.

convert gpt

Converts an empty basic MBR disk to GPT. The disk must meet the command’s requirements; conversion is not a safe method for casually changing a disk that contains needed partitions.

A command window does not accept apologies after clean. Confirm the selected object before every DiskPart command.

chkdsk and diskpart commands demonstrated and explained

ipconfig command demonstrated and explained

IPConfig: Diagnose Basic Network Settings

ipconfig displays IP addressing information.

ipconfig

For detailed adapter, DHCP, gateway, and DNS information:

ipconfig /all

To clear the local DNS resolver cache:

ipconfig /flushdns

To view cached DNS entries:

ipconfig /displaydns

For a DHCP-configured adapter, release and renew the address with:

ipconfig /release
ipconfig /renew

/release temporarily removes DHCP-assigned addresses, and /renew requests new ones. These commands can interrupt network access. They are not appropriate for casually replacing a manually configured static IP address. Record static IP, gateway, DNS, VPN, and business-network settings before making changes.

Ping, NSLookup, and Tracert

Ping tests whether an address responds to ICMP echo requests.

ping 127.0.0.1

Tests the local TCP/IP stack without leaving the computer.

ping 192.168.1.1

Tests a common gateway address. Replace 192.168.1.1 with the gateway shown by ipconfig /all.

ping 1.1.1.1

Tests connectivity to a public IP address without depending on DNS name resolution.

ping example.com

Tests name resolution and connectivity to a hostname.

A failed ping does not always prove that a device or service is offline. Firewalls, routers, and remote hosts may block ICMP.

To query DNS:

nslookup example.com

This shows whether a DNS server can resolve the hostname and identifies the response received.

To display the path toward a destination:

tracert example.com

tracert shows intermediary hops when responses are available. Timeouts at one hop do not automatically prove a routing failure; some routers suppress or deprioritize traceroute responses while forwarding traffic normally.

Netsh: Reset Common Network Components

These commands can repair certain damaged Winsock or TCP/IP settings:

netsh winsock reset
netsh int ip reset

A restart is generally required afterward:

shutdown /r /t 0

Save a network configuration dump before changing settings:

ipconfig /all > "%USERPROFILE%\Desktop\network-config.txt"

Winsock and TCP/IP resets can affect VPN software, custom DNS settings, static addresses, and specialized network configurations. Do not routinely use netsh advfirewall reset; resetting the firewall can remove intentional rules and create new security or connectivity problems.

Tasklist and Taskkill: Inspect Stuck Programs

List running processes:

tasklist

Show expanded process details:

tasklist /v

Show applications that are not responding:

tasklist /fi "STATUS eq NOT RESPONDING"

To stop a process by process ID:

taskkill /pid N

Replace N with the verified process ID.

To force-close the process and its child processes:

taskkill /pid N /f /t

To stop a process by image name:

taskkill /im notepad.exe

Force-closing can discard unsaved work. An unfamiliar Windows process should not be terminated casually. Process names alone are not proof of malware or a problem; context and file location matter.

Memory, Battery, Power, and System Reports

Start Windows Memory Diagnostic:

mdsched.exe

The tool schedules a restart and tests system memory. A short clean test does not rule out intermittent RAM faults, temperature-related failures, motherboard problems, or errors that occur only under specific workloads.

Generate a laptop battery report:

powercfg.exe /batteryreport /output "%USERPROFILE%\Desktop\battery-report.html"

The report is saved to the desktop and includes battery capacity and usage history when Windows has collected the relevant information.

Generate an energy-efficiency report:

powercfg.exe /energy /output "%USERPROFILE%\Desktop\energy-report.html"

The energy test runs for approximately 60 seconds. Close unnecessary applications and allow the system to remain relatively idle during the test. The report identifies configuration observations, not every possible battery, charger, power-management, or hardware fault.

For general system information:

systeminfo

Display the Windows version:

ver

List installed device drivers and associated information:

driverquery

Show more detailed driver information:

driverquery /v

A listed driver is not proof that the driver is functioning correctly. The report is an inventory and starting point for further investigation.

tasklist command demonstrated and explained

A Symptom-Based Order of Operations

Do not run every command simply because it is available. A practical sequence is:

Symptom Reasonable starting point
Windows errors, missing system functions, or repeated update failures DISM /RestoreHealth, followed by SFC /scannow
File-system warnings or an unexpectedly dirty volume chkdsk C: /scan, followed by /f when appropriate
No network access ipconfig /all, gateway ping, public-IP ping, then hostname ping
DNS-specific failures ipconfig /displaydns, ipconfig /flushdns, and nslookup
A frozen application tasklist /v, then targeted taskkill only after identifying the process
Suspected memory instability mdsched.exe, with additional testing if symptoms continue
Laptop battery concerns powercfg.exe /batteryreport
Unknown Windows version or driver context systeminfo, ver, and driverquery

Command Prompt is not the right first tool for clicking or disappearing drives, liquid damage, burning smells, repeated power loss, severe overheating, a failing power supply, charging-port damage, or data stored only on a questionable drive. Those conditions call for hardware evaluation or data-preservation decisions before software repair.

The commands above remain useful as educational references, but output should always be interpreted in relation to the actual symptom and hardware condition. ErlenTek is based in Auburn, Washington, but this guide is intended to stand on its own as a general Windows reference.

Back to blog

Leave a comment