Essential Windows Command Prompt commands for navigation, networking, file management, and system troubleshooting.
| Command(s) | Explanation |
|---|---|
cd / cd . / cd .. |
cd shows or changes the current directory. |
cd . means stay in the current directory. |
|
cd .. moves up one level (to the parent directory). |
|
dir |
Lists files and folders in the current directory. |
cls |
Clears the Command Prompt screen. |
echo <text> |
Displays messages or enables/disables command echoing. |
exit |
Closes the Command Prompt window. |
ipconfig / ipconfig /all / ipconfig /flushdns |
ipconfig shows basic network info. |
/all shows full network details (MAC, DNS, DHCP). |
|
/flushdns clears the DNS cache. |
|
ping <host> |
Tests network connectivity to an IP or hostname (e.g., ping google.com). |
tracert <host> |
Traces the route packets take to reach a destination. |
netstat |
Displays active network connections, routing tables, and listening ports. |
tasklist |
Displays all running processes with their PID and memory usage. |
taskkill /PID <id> / taskkill /IM <name> |
Terminates a process by PID (/PID) or by name (/IM). |
shutdown /s /t <time> / shutdown /r |
Shuts down the computer (/s) or restarts (/r) after a delay in seconds (/t). |
chkdsk / chkdsk /f |
Checks disk for errors. /f fixes errors automatically. |
sfc /scannow |
Runs the System File Checker to repair corrupted system files. |
copy <src> <dest> |
Copies files from one location to another. |
xcopy <src> <dest> /s /e |
Copies files and directories, including subdirectories. |
robocopy <src> <dest> |
Advanced file copy with mirroring and recovery options. |
del <file> / erase <file> |
Deletes one or more files. |
rmdir <folder> / rmdir /s <folder> |
Deletes a folder. /s removes subfolders too. |
mkdir <folder> |
Creates a new directory (folder). |
attrib |
Displays or changes file/folder attributes (e.g., hidden, read-only). |
icacls <file/folder> |
Displays or modifies Access Control Lists (ACLs), used to view or change permissions on files/folders. |
whoami |
Displays the current logged-in user. |
hostname |
Shows the computer’s hostname. |
net user |
Lists all user accounts on the system. |
net use |
Displays or connects to shared network resources. |
net share |
Shows or creates shared folders on the computer. |