The most powerful troubleshooting tool on your PC has been hiding in plain sight since Windows 95. CMD commands โ typed directly into the Windows Command Prompt โ let you diagnose network faults, repair corrupted system files, kill runaway processes, and manage routing tables without ever opening a settings menu. Whether you’re on Windows 10 or Windows 11, every command below works the same way and takes under a minute to run.
Open CMD by pressing Windows + R, typing cmd, and hitting Enter. For commands that require administrator privileges (chkdsk, sfc, DISM, netsh firewall), right-click the Start menu and choose Command Prompt (Admin) or Windows Terminal (Admin).
Networking CMD Commands

Network faults are the number-one reason people reach for the Command Prompt. These command prompt commands give you instant visibility into your IP configuration, DNS cache, and wireless environment.
ipconfig โ Your Starting Point for Any Network Problem
Type ipconfig and you instantly see your IPv4 address, subnet mask, and default gateway for every active adapter. Add the /all flag โ ipconfig /all โ to surface MAC addresses, DHCP server details, DNS server IPs, and lease information. Pipe the output into findstr to filter just the line you need:
ipconfig /all | findstr "IPv4"
ipconfig /release, /renew, and /flushdns
Three commands that fix the majority of everyday connectivity headaches:
-
ipconfig /releaseโ drops your current DHCP-assigned IP address. -
ipconfig /renewโ requests a fresh IP from the DHCP server. Run these back-to-back when a device gets stuck on the wrong address. -
ipconfig /displaydnsโ lists every domain your PC has recently resolved, piped through| clipto copy the output directly to your clipboard. -
ipconfig /flushdnsโ wipes the local DNS resolver cache. Indispensable after a domain migration or when a site refuses to load despite working on other devices.
nslookup โ Query DNS Records Directly
nslookup google.com sends a DNS query and returns the resolved IP address and the responding server. Switch servers on the fly: nslookup google.com 8.8.8.8 queries Google’s public DNS instead of your ISP’s, letting you confirm whether a DNS problem is local or upstream.
ping and ping -t
ping 8.8.8.8 sends four ICMP packets and reports round-trip time and packet loss โ the quickest proof of whether your internet path is alive. Add -t for a continuous stream that keeps measuring until you press Ctrl+C, ideal for watching a flaky connection in real time.
tracert and tracert -d
tracert google.com traces the hop-by-hop path between your PC and a destination, showing latency at every router along the way. High latency at hop 3 but fine at hop 10? Your ISP’s backbone is fine; the issue is closer to home. Add -d to skip reverse DNS lookups and get results roughly twice as fast.
netstat โ See Every Active Connection
These Windows CMD variants reveal what’s talking to your machine:
-
netstat -afโ all active TCP/UDP connections plus the fully qualified domain name of each remote endpoint. -
netstat -oโ appends the Process ID (PID) of the owning application so you can cross-reference with Task Manager. -
netstat -e -t 5โ refreshes Ethernet statistics every 5 seconds, showing cumulative bytes sent and received in near-real time.
netsh โ Advanced Network Shell Commands
The netsh tool is one of the most versatile Windows terminal commands available. Key variants:
-
netsh wlan show wlanreportโ generates an HTML report of your Wi-Fi connection history, saved to C:\ProgramData\Microsoft\Windows\WlanReport\. -
netsh interface show interfaceโ lists every network adapter and its current state (enabled/disabled). -
netsh interface ip show address | findstr "IP Address"โ filters down to just your active IPs. -
netsh interface ip show dnsserversโ confirms which DNS servers each adapter is using. -
netsh advfirewall set allprofiles state off/onโ disables or re-enables Windows Firewall across all profiles. Use only for short-term testing; always turn it back on.
route โ View and Manage the Routing Table
route print displays your full IP routing table, useful on machines with multiple network interfaces (e.g., VPN + LAN). route add and route delete let you manually inject or remove static routes โ essential for IT administrators managing split-tunnel VPNs.
System Diagnostics and Repair CMD Commands

When Windows starts acting slow or throwing errors, these CMD commands are your first line of defence โ no reinstall required.
chkdsk /f and chkdsk /r
chkdsk C: /f scans your drive for file system errors and fixes them automatically. chkdsk C: /r goes further, locating bad sectors and recovering readable data. Both require a restart to run on the active system drive โ Windows schedules them for the next boot. Run as administrator.
sfc /scannow โ System File Checker
sfc /scannow scans every protected Windows system file and replaces any that are corrupted or missing with a cached clean copy. The scan typically completes in 5โ15 minutes and produces a log at %windir%\Logs\CBS\CBS.log. Run this before reaching for a full Windows reinstall.
DISM โ Repair the Component Store
If sfc /scannow reports it cannot fix errors, DISM (Deployment Image Servicing and Management) repairs the underlying Windows image store that sfc draws from. Run these three in order:
-
DISM /Online /Cleanup-Image /CheckHealthโ reads a flag in the image to check for known corruption (instantaneous). -
DISM /Online /Cleanup-Image /ScanHealthโ actively scans the component store (takes a few minutes). -
DISM /Online /Cleanup-Image /RestoreHealthโ downloads and replaces corrupted components from Windows Update (requires internet; can take 20โ30 minutes).
After RestoreHealth completes, run sfc /scannow again โ it will now succeed.
powercfg /energy and powercfg /batteryreport
powercfg /energy runs a 60-second power efficiency trace and exports an HTML report flagging battery and power-plan issues. powercfg /batteryreport generates a detailed battery history, showing design capacity versus current full-charge capacity โ the single best way to confirm whether a laptop battery is degrading. Both commands save their reports to the current working directory.
Command Prompt Commands for Processes and File Associations

These lesser-known command prompt commands are enormously practical once you know they exist.
tasklist and taskkill
tasklist prints every running process with its PID, memory usage, and session name โ the CLI equivalent of Task Manager’s Details tab. Filter it: tasklist | findstr "chrome" shows only Chrome-related processes. To terminate a frozen process: taskkill /PID 1234 /F forces an immediate kill using the PID from tasklist. No need to open Task Manager at all.
assoc โ File Extension Associations
assoc lists every file extension registered on your system and the program type associated with it. assoc .mp4 shows what opens MP4 files; assoc .txt=txtfile reassigns .txt to the default text handler. This is the fastest way to fix broken “open with” associations without digging through Settings.
getmac /v
getmac /v displays the MAC (hardware) address of every network adapter along with its friendly name and connection status. Faster than hunting through Device Manager, and useful when a network switch or DHCP reservation needs the physical address.
cls โ Clear the Screen
Type cls and press Enter to wipe the Command Prompt window. Simple, but invaluable when you’ve been running diagnostics for an hour and the terminal is a wall of text.
Administration and Utility Windows CMD Commands
shutdown /r /fw /f /t 0
This single command reboots your PC directly into the UEFI/BIOS firmware interface โ no more hammering F2 or Del at boot. Breaking it down: /r restarts, /fw boots into firmware, /f forces running applications to close, /t 0 sets a zero-second delay. Essential for changing boot order or enabling TPM settings required for a Windows 11 upgrade.
clip โ Pipe Any Output to the Clipboard
Append | clip to any command and its output lands in your clipboard, ready to paste into Notepad, a support ticket, or an email. Example: ipconfig /all | clip copies your full network configuration without any mouse selection.
Quick-Reference: All 40 CMD Commands by Category
Here is a consolidated list of the Windows CMD commands covered in this guide, organised by function:
-
Network info: ipconfig, ipconfig /all, ipconfig /release, ipconfig /renew, ipconfig /displaydns, ipconfig /flushdns, nslookup, getmac /v
-
Connectivity testing: ping, ping -t, tracert, tracert -d
-
Connection monitoring: netstat, netstat -af, netstat -o, netstat -e -t 5
-
Network management: netsh wlan show wlanreport, netsh interface show interface, netsh interface ip show address, netsh interface ip show dnsservers, netsh advfirewall state off/on, route print, route add, route delete
-
Disk and system repair: chkdsk /f, chkdsk /r, sfc /scannow, DISM /CheckHealth, DISM /ScanHealth, DISM /RestoreHealth
-
Power management: powercfg /energy, powercfg /batteryreport
-
Process management: tasklist, taskkill
-
File and output utilities: assoc, findstr, clip, cls
-
Administration: shutdown /r /fw /f /t 0
For the complete official reference covering every Windows command available, Microsoft maintains the authoritative documentation at Windows Commands โ Microsoft Learn.
Getting the most from these command prompt commands starts with having a genuine, activated copy of Windows. A properly licensed OS ensures Windows Update, sfc, and DISM all function correctly โ none of these repair tools work reliably on an unactivated system. If you’re not sure whether your licence is valid, check out our guide on how to verify your Windows licence is genuine, or grab a fully licensed copy of Windows 11 Pro at Buy Now Key โ from just โฌ17.90 โ so every CMD repair command works exactly as intended.
Frequently Asked Questions
Do these CMD commands work on both Windows 10 and Windows 11?
Yes. Every command listed in this guide runs identically on Windows 10 and Windows 11. The Command Prompt shell (cmd.exe) has remained consistent across both versions. On Windows 11, you can also run these commands inside Windows Terminal, which offers tabs and a modern interface while executing the same underlying instructions.
Do I Need to Run These CMD Commands as Administrator?
Not all of them. Commands like ipconfig, ping, tracert, netstat, tasklist, nslookup, and cls work fine in a standard CMD window. However, chkdsk, sfc /scannow, DISM, netsh advfirewall, and shutdown /r /fw all require elevated (administrator) privileges. Right-click the Start menu and choose Terminal (Admin) or Command Prompt (Admin) before running those.
What is the difference between sfc /scannow and DISM?
System File Checker (sfc) compares individual Windows system files against cached copies stored on your local drive and replaces any that are damaged. DISM operates one level deeper โ it repairs the Windows component store (the source sfc pulls from). If sfc reports errors it cannot fix, it usually means the component store itself is corrupt, and DISM /RestoreHealth (which downloads clean files from Microsoft) is the correct next step.
Which Command Prompt Commands Flush the DNS Cache?
Run ipconfig /flushdns in an elevated Command Prompt. Your PC caches DNS lookups to speed up browsing, but stale entries can cause a site to load incorrectly โ or not at all โ after a domain has been moved to a new server. Flushing the cache forces Windows to request a fresh lookup the next time you visit that domain, resolving the problem instantly in most cases.
Can I undo a route add command in Windows CMD?
Yes. Use route delete <destination> where the destination matches what you added. Static routes added without the -p (persistent) flag are automatically removed on reboot, so a restart is also a reliable way to clear any manually added routes. Use route print first to confirm exactly what is currently in the table.



























