Here’s a list of some of the most useful Command Prompt (CMD) commands in Windows, organized by category:
Basic Commands
dir
Displays the contents of a directory.
Example: dir C:\Users
cd
Changes the current directory.
Example: cd Documents
cls
Clears the Command Prompt screen.
exit
Closes the Command Prompt window.
help
Displays a list of available commands or help for a specific command.
Example: help copy
File and Directory Management
mkdir
Creates a new directory.
Example: mkdir NewFolder
rmdir
Deletes a directory (use /s to delete non-empty directories).
Example: rmdir /s OldFolder
copy
Copies files to a specified location.
Example: copy file.txt D:\Backup
move
Moves files or renames them.
Example: move file.txt D:\Documents
del
Deletes files.
Example: del unwanted_file.txt
System and Network Commands
ipconfig
Displays network configuration details.
Example: ipconfig /all
ping
Tests connectivity to another system.
Example: ping google.com
tracert
Traces the route packets take to reach a destination.
Example: tracert google.com
netstat
Displays active network connections and listening ports.
Example: netstat -an
tasklist
Lists all running processes.
taskkill
Terminates a process.
Example: taskkill /im notepad.exe /f
Disk and System Management
chkdsk
Checks and repairs disk errors.
Example: chkdsk C: /f /r
diskpart
Opens the Disk Partition Manager.
format
Formats a disk.
Example: format D:
sfc
Scans and repairs system files.
Example: sfc /scannow
shutdown
Shuts down or restarts the computer.
Example: shutdown /r /t 30 (Restart after 30 seconds).
User and System Information
whoami
Displays the current logged-in user.
systeminfo
Shows detailed system information.
hostname
Displays the computer’s name.
powercfg
Manages power settings.
Example: powercfg /hibernate off
wmic
Executes system management tasks.
Example: wmic diskdrive get status
Advanced Commands
fc
Compares two files.
Example: fc file1.txt file2.txt
find
Searches for a specific string in a file.
Example: find "error" logfile.txt
assoc
Displays or changes file associations.
Example: assoc .txt
path
Displays or sets the search path for executable files.
tree
Displays the directory structure of a path.
Example: tree C:\
These commands can simplify troubleshooting, file management, and system maintenance tasks. Let me know if you want detailed usage for any specific command!