The Windows Command Prompt (CMD) is a powerful tool that allows users to control and troubleshoot their system using text-based commands. Whether you’re a beginner or an advanced user, knowing key CMD commands can significantly enhance your ability to manage your system efficiently.
In this post, we’ll cover must-know Command Prompt commands, explaining what each one does and how it can be used effectively.
1. ipconfig
Purpose: Displays the current IP configuration of your network adapters.
📌 Usage:
ipconfig
🔹 This command provides essential information like IP address, subnet mask, and default gateway for each network adapter.
2. ipconfig /all
Purpose: Displays detailed IP configuration, including MAC addresses and DHCP status.
📌 Usage:
ipconfig /all
🔹 This gives more in-depth details about all network adapters compared to the basic ipconfig command.
3. findstr
Purpose: Searches for specific text within files or command output.
📌 Usage:
ipconfig /all | findstr "IPv4"
🔹 The example above filters out only the IPv4 address from ipconfig /all.
4. ipconfig /release
Purpose: Releases the current IP address assigned by DHCP.
📌 Usage:
ipconfig /release
🔹 Useful when troubleshooting network issues or switching networks.
5. ipconfig /renew
Purpose: Requests a new IP address from the DHCP server.
📌 Usage:
ipconfig /renew
🔹 Used after releasing the IP to obtain a fresh one.
6. ipconfig /displaydns
Purpose: Displays the DNS cache stored on your computer.
📌 Usage:
ipconfig /displaydns
🔹 Helps check cached DNS records, useful for troubleshooting name resolution issues.
7. clip
Purpose: Copies the output of a command to the clipboard.
📌 Usage:
ipconfig /all | clip
🔹 Instead of displaying output in CMD, it copies the result to the clipboard for easy pasting.
8. ipconfig /flushdns
Purpose: Clears the DNS cache, forcing a refresh.
📌 Usage:
ipconfig /flushdns
🔹 Helps resolve website access issues due to stale DNS records.
9. nslookup
Purpose: Queries DNS records for a domain.
📌 Usage:
nslookup google.com
🔹 Returns IP addresses of a website or domain.
10. cls
Purpose: Clears the command prompt screen.
📌 Usage:
cls
🔹 Clears clutter for a fresh terminal view.
11. getmac /v
Purpose: Displays the MAC address of all network adapters.
📌 Usage:
getmac /v
🔹 Useful for identifying devices on a network.
12. powercfg /energy
Purpose: Generates a detailed power consumption report.
📌 Usage:
powercfg /energy
🔹 Helps analyze power efficiency and battery drain issues.
13. powercfg /batteryreport
Purpose: Generates a battery health report.
📌 Usage:
powercfg /batteryreport
🔹 Provides battery wear analysis, helping to diagnose performance issues.
14. assoc
Purpose: Displays file associations (which file type opens with which program).
📌 Usage:
assoc
🔹 Helpful for troubleshooting file-opening issues.
15. chkdsk /f
Purpose: Scans and fixes file system errors on a disk.
📌 Usage:
chkdsk C: /f
🔹 Repairs minor disk issues and corrupt files.
16. chkdsk /r
Purpose: Scans and repairs bad sectors on a disk.
📌 Usage:
chkdsk C: /r
🔹 More thorough than /f, this command checks for physical errors.
17. sfc /scannow
Purpose: Scans and repairs corrupted system files.
📌 Usage:
sfc /scannow
🔹 Useful when experiencing OS corruption issues.
18. DISM /Online /Cleanup /CheckHealth
Purpose: Checks Windows image health.
📌 Usage:
DISM /Online /Cleanup /CheckHealth
🔹 Verifies if the system image has corruption.
19. DISM /Online /Cleanup /ScanHealth
Purpose: Scans Windows for corruption.
📌 Usage:
DISM /Online /Cleanup /ScanHealth
🔹 More detailed than CheckHealth, useful for system integrity checks.
20. DISM /Online /Cleanup /RestoreHealth
Purpose: Repairs Windows image corruption.
📌 Usage:
DISM /Online /Cleanup /RestoreHealth
🔹 Used when sfc /scannow fails to fix corruption.
21. tasklist
Purpose: Displays all running processes.
📌 Usage:
tasklist
🔹 Lists active tasks like Task Manager.
22. taskkill
Purpose: Terminates a process by PID or name.
📌 Usage:
taskkill /IM notepad.exe /F
🔹 Forces Notepad to close.
23-28. Netsh Commands
Purpose: Network troubleshooting and configuration.
📌 Examples:
netsh wlan show wlanreport
netsh interface show interface
netsh interface ip show dnsservers
netsh advfirewall set allprofiles state off
netsh advfirewall set allprofiles state on
🔹 Manage WiFi, firewall, and IP settings.
29-36. Network Troubleshooting Commands
🔹 ping – Checks connectivity.
🔹 tracert – Traces route to a server.
🔹 netstat – Displays network connections.
📌 Examples:
ping google.com
tracert google.com
netstat -af
37-39. Route Commands
🔹 route print – Shows routing table.
🔹 route add – Adds a new route.
🔹 route delete – Deletes a route.
📌 Example:
route print
40. shutdown /r /fw /f /t 0
Purpose: Restarts PC into firmware (BIOS/UEFI).
📌 Usage:
shutdown /r /fw /f /t 0
🔹 Useful for quick access to BIOS.
Final Thoughts
Mastering these CMD commands can greatly improve system troubleshooting, networking, and performance optimization. Bookmark this guide for quick reference! 🚀💻
