In this guide, we will explore the most useful and important CMD commands that every Windows user should know. It doesn’t matter if you are a computer expert or a beginner venturing into the world of the command line for the first time.
Ready? Let’s get started.
ipconfig
ipconfig
: provides your computer’s IP configuration information
ipconfig // Show IP information ipconfig /all // Shows all IP configuration information ipconfig /release // Releases all DHCP leases for all cards
ping
ping
: checks network connectivity to another host on the IP network
ping google.com // Sends ping packets to google.com ping 192.168.1.1 // Sends ping packets to IP address 192.168.1.1 ping -n 10 google.com // Send 10 ping packets to google.com
netstat
netstat
: shows network connections (both incoming and outgoing), routing tables, and interface statistics
netstat // Show all active connections netstat -a // Shows all connections and listening ports netstat -r // Show the routing table
tracert
tracert
: traces the path that network packets take from one host to another
tracert google.com // Trace the path to google.com tracert 192.168.1.1 // Traces the path to IP address 192.168.1.1 tracert -d google.com // Trace the path to google.com without resolving addresses to host names
nslookup
nslookup
: allows querying DNS servers to find DNS records for a domain
nslookup google.com // Find DNS records for google.com nslookup -type=mx google.com // Find MX record for google.com nslookup google.com 8.8.8 // Find DNS record for google.com using DNS server 8.8.8.8
sfc /scannow
sfc /scannow
: scans system files for problems and attempts to repair them
sfc /scannow // Scans all system files and fixes errors
chkdsk
chkdsk
: checks a disk or partition for errors and offers to fix them
chkdsk // Checks the C: drive for errors chkdsk /f // Corrects errors on the disk chkdsk D: /r // Finds bad sectors and recovers readable information
systeminfo
systeminfo
: provides detailed information about your system
systeminfo // Shows basic system information
gpupdate /force
gpupdate /force
: immediately enforces all changed group policies
gpupdate /force // Apply all changed group policies
diskpart
diskpart
: a powerful tool for managing your hard disk partitions
diskpart // Opens the diskpart utility
tasklist
tasklist
: shows all processes currently running on your system
tasklist // Shows all processes currently running tasklist /v // Shows details of all running processes tasklist /svc // Show related services for each process
taskkill
taskkill
: terminate a specific task
taskkill /im notepad.exe // Terminate all "notepad.exe" tasks taskkill /pid 1234 // Terminate the task with the ID 1234 taskkill /im notepad.exe /t // Terminates "notepad.exe" and associated child processes
fc
fc
: compares two files and shows the differences between them
fc file1.txt file2.txt // Compare file1.txt and file2.txt
find
find
: looks for a specific text string in a file
find "text" file.txt // Search for "text" in file.txt find /v "text" file.txt // Show all lines that do not contain "text" in file.txt find /i "text" file.txt // Search for "text" in file.txt ignoring the case-sensitive distinction
Remember that using the Command Prompt can have significant consequences if not used correctly. Before using any command, make sure you understand exactly what it does and how it might affect your system.