The Command Prompt (CMD) is a built-in command-line tool in every version of Windows. Whether you want to manage files, troubleshoot network issues, or automate tasks, CMD provides powerful commands to help you control your system efficiently.
This guide provides a complete, categorized list of CMD commands and their main uses—ideal for beginners, tech enthusiasts, and IT professionals.
How to Open the Command Prompt
You can open CMD by:
- Pressing Windows + R, typing
cmd
, and hitting Enter - Searching the Command Prompt from the Start menu
- Right-clicking and selecting Run as administrator (for system-level commands)
1. Basic File and Folder Commands
Used to view, create, move, and delete files or directories.
Command | What It Does |
---|---|
dir |
Lists contents of a folder |
cd |
Changes directory |
md or mkdir |
Creates a new folder |
rd or rmdir |
Deletes a folder |
del |
Deletes files |
copy |
Copies files |
move |
Moves files |
rename |
Renames files or folders |
tree |
Displays folder structure as a tree |
2. System Information & Troubleshooting
Commands to monitor and fix system issues.
Command | Use |
---|---|
systeminfo |
Shows system configuration details |
ver |
Displays Windows version |
sfc /scannow |
Scans and repairs system files |
chkdsk |
Checks disk for errors |
tasklist |
Lists running processes |
taskkill |
Ends a process by name or ID |
set |
Shows environment variables |
3. Networking Commands
Helpful for diagnosing and managing network settings.
Command | Use |
---|---|
ping |
Tests connectivity to another device |
tracert |
Traces path of a network packet |
ipconfig |
Displays IP settings |
netstat |
Shows active network connections |
nslookup |
Checks DNS info |
netsh |
Configures network settings |
arp |
Views ARP cache |
4. User and Access Control
Manage user accounts and permissions.
Command | Use |
---|---|
net user |
Adds, edits, or displays user accounts |
net localgroup |
Manages local user groups |
whoami |
Displays current user name |
runas |
Runs a program with another user’s credentials |
5. Disk and Drive Management
Control drives, partitions, and formatting.
Command | Use |
---|---|
diskpart |
Launches disk partition tool |
format |
Formats a drive |
label |
Changes or creates drive label |
vol |
Shows volume label and serial number |
mountvol |
Manages volume mount points |
6. Services and Processes
Start, stop, or query Windows services.
Command | Use |
---|---|
sc query |
Displays service status |
sc start |
Starts a service |
sc stop |
Stops a service |
tasklist |
Lists active tasks |
taskkill |
Kills a task or process by PID or name |
7. Batch Script and Automation
Used for scripting and automating tasks in .bat
files.
Command | Use |
---|---|
echo |
Displays a message or turns command echoing on/off |
pause |
Pauses script until user input |
cls |
Clears the screen |
if |
Creates conditional logic |
goto |
Jumps to a specific label in script |
call |
Runs another batch file or command |
set |
Sets a variable value |
8. Shutdown and Restart
Control your system’s power actions.
Command | Use |
---|---|
shutdown /s |
Shuts down computer |
shutdown /r |
Restarts computer |
shutdown /l |
Logs out current user |
shutdown /a |
Aborts scheduled shutdown |
logoff |
Logs off user from session |
9. Network File Sharing and Access
For file sharing and connecting to network devices.
Command | Use |
---|---|
net share |
Displays or sets up shared folders |
net use |
Maps a network drive |
net view |
Lists shared resources on a network |
CMD Tips and Hidden Features (Explained)
Command Prompt includes several hidden shortcuts and features that make it easier to work with. For example, pressing F7 brings up a pop-up window that shows your recent command history. This helps you re-run previous commands without retyping them, which is especially useful for troubleshooting or repetitive tasks.
If a command takes too long or you need to stop it, pressing Ctrl + C will immediately terminate the running process. This is helpful when you accidentally run the wrong command or want to cancel an operation.
If you’re not sure what a command does, you can type help
followed by the command name—for example, help ipconfig
. This will display a brief explanation of the command, its syntax, and available options.
You can also save the output of any command by using the greater-than symbol >
followed by a file name. For example, ipconfig > info.txt
saves the network details into a file named info.txt in the current directory. This is useful for creating logs or sharing system details with support teams.
Conclusion
The Command Prompt is a powerful tool that gives you complete control over your Windows system. Knowing these CMD commands can save you time and effort, whether fixing a network problem, managing files, or automating repetitive tasks.
Bookmark this guide as your go-to reference for any Windows version’s most essential and advanced CMD commands.