CMD Commands: The Complete Windows Command Prompt Reference Guide (2026)

Unlock Windows' hidden power with essential CMD commands. This complete guide covers networking, system tools, and automation. Dive in and take control today!

antoniopartha
By
antoniopartha
Antonio Partha bridges the gap between high-level engineering and everyday understanding. With a firm belief that technological literacy should be universal, Antonio has dedicated his career...

Over 1.4 billion people use Windows worldwide — and most of them have never opened the command prompt. That’s a missed opportunity. Buried behind that blinking cursor is one of the most powerful toolsets your operating system offers: raw, direct control over files, networks, system processes, and security. No third-party apps. No subscriptions. Just CMD commands that have quietly powered IT professionals, developers, and power users for decades.

Whether you’re fixing a broken network connection at 11 PM, automating repetitive file tasks, or digging into system diagnostics, the Windows Command Prompt delivers. This guide covers everything — from foundational navigation commands to advanced networking and administrative tools. Bookmark it. You’ll come back.

What Is the Windows Command Prompt?

The Windows Command Prompt (cmd.exe) is a command-line interpreter built into every version of Microsoft Windows. It traces its roots back to MS-DOS and gives users the ability to interact with the operating system through typed text commands rather than a graphical interface.

It’s not just a relic of the past. Today, CMD remains invaluable for:

  • System administration — managing users, permissions, and services
  • Network troubleshooting — diagnosing connectivity issues with precision
  • File automation — batch processing files and folders at scale
  • System repair — fixing corrupted files, boot issues, and disk errors
  • Developer workflows — running scripts, compiling code, managing environments

How to Open CMD in Windows

Before running CMD commands, you need to access the terminal. Here are the fastest methods:

  • Method 1 — Run Dialog (fastest) Press Win + R, type cmd, and hit Enter.
  • Method 2 — Start Menu Search Click Start, type Command Prompt, right-click and select Run as administrator for elevated access.
  • Method 3 — From File Explorer Navigate to any folder, click the address bar, type cmd, and press Enter — this opens CMD directly in that directory.
  • Method 4 — Task Manager Open Task Manager → File → Run New Task → type cmd.

Pro Tip

Many system-level CMD commands require administrator privileges. Always right-click and choose “Run as administrator” when dealing with system settings, disk operations, or network configurations.

CMD Commands: The Master Reference List

Basic Navigation & File Management CMD Commands

These are the commands you’ll use every single session. They form the backbone of working in the command prompt environment.

CommandSyntaxWhat It Does
dirdir [path]Lists files and folders in the current directory
cdcd [folder]Changes the current directory
cd ..cd ..Moves up one directory level
cd /cd /Returns to the root of the current drive
clsclsClears the command prompt screen
mkdirmkdir [name]Creates a new folder
rmdirrmdir /s /q [name]Deletes a folder and its contents
deldel [filename]Deletes one or more files
copycopy [src] [dest]Copies files to a new location
movemove [src] [dest]Moves files to a new location
renren [old] [new]Renames a file or folder
typetype [file]Displays the contents of a text file
echoecho [text]Prints text to the screen or a file
treetree [path]Displays a folder structure as a tree
attribattrib +h [file]Changes file attributes (hidden, read-only)

Real-world use: IT technicians use dir /s /b *.log to recursively find all log files across a directory tree — saving hours of manual searching. Check out the Official Windows Command Reference.

System Information CMD Commands

These commands pull detailed data about your hardware, OS, and running environment — essential for diagnostics and asset management. Use System File Checker Tool for better understanding.

CommandWhat It Does
systeminfoDisplays comprehensive system details: OS version, RAM, hotfixes, and network adapters
verShows the current Windows version
hostnameDisplays the computer’s network name
whoamiShows the currently logged-in user and domain
setLists all current environment variables
wmicWindows Management Instrumentation — deep hardware queries
driverqueryLists all installed device drivers
tasklistShows all currently running processes
taskkillTerminates a process by name or PID

Example — Kill a hung process:

cmd

taskkill /f /im notepad.exe

The /f flag forces termination. Replace notepad.exe with whatever application is frozen.

Example — Query CPU details via WMIC:

cmd

wmic cpu get name, maxclockspeed, numberofcores

Network Troubleshooting CMD Commands

This is where CMD commands truly shine. Network diagnostics that would take minutes in a GUI interface take seconds here.

CommandSyntaxWhat It Does
ipconfigipconfig /allShows all network adapter IP details
pingping [host]Tests connectivity to a host
tracerttracert [host]Traces the route packets take to a destination
nslookupnslookup [domain]Queries DNS records for a domain
netstatnetstat -anShows active connections and listening ports
arparp -aDisplays the ARP cache (IP-to-MAC mapping)
pathpingpathping [host]Combines ping and tracert with packet loss stats
netshnetsh wlan show profilesManages network settings and shows Wi-Fi profiles
nbtstatnbtstat -nShows NetBIOS name table and MAC address

Power user trick — View saved Wi-Fi passwords:

cmd

netsh wlan show profile name="YourNetworkName" key=clear

Look for “Key Content” in the output. This is the actual password for the saved Wi-Fi network.

Release and renew IP address:

cmd

ipconfig /release
ipconfig /renew

Flush DNS cache (fixes most “site not loading” issues):

cmd

ipconfig /flushdns

Disk & Drive Management CMD Commands

These commands let you inspect, manage, and repair storage drives without needing third-party software.

CommandWhat It Does
chkdskChecks and repairs disk errors
diskpartLaunches the disk partition management tool
formatFormats a drive or partition
defragDefragments a hard drive (HDD only)
sfc /scannowScans and repairs corrupted Windows system files
dismRepairs Windows image and system components
volDisplays the volume label and serial number of a disk
fsutilAdvanced file system utility (requires admin)

Most important command for a broken Windows installation:

cmd

sfc /scannow

This scans all protected system files and replaces corrupted ones automatically. Run it as administrator. If SFC fails, escalate to:

cmd

DISM /Online /Cleanup-Image /RestoreHealth

Check disk health:

cmd

chkdsk C: /f /r

/f fixes errors. /r locates bad sectors. Schedule on restart when the drive is in use.

User & Permission Management CMD Commands

Administrators rely on these commands to manage accounts, groups, and access control across machines.

CommandWhat It Does
net userLists all user accounts on the system
net user [name] *Changes a user’s password interactively
net user [name] /addCreates a new user account
net user [name] /deleteRemoves a user account
net localgroupLists local user groups
net localgroup Administrators [user] /addAdds a user to the Administrators group
whoami /privShows current user’s privileges
runasRuns a program as a different user

Create a local admin account (useful for recovery):

cmd

net user TechAdmin Password123 /add
net localgroup Administrators TechAdmin /add

Process & Service Management CMD Commands

Monitor and control what’s running on your system — without opening Task Manager.

CommandWhat It Does
tasklistLists all running processes with PID
taskkill /f /pid [PID]Force-kills a process by its Process ID
sc queryLists all services and their status
sc start [service]Starts a Windows service
sc stop [service]Stops a Windows service
net startLists all currently running services
wmic process list briefSummarized list of running processes with CPU/memory

Example — Restart the Windows Update service:

cmd

sc stop wuauserv
sc start wuauserv

Batch Scripting & Automation Tricks

CMD commands become exponentially more powerful when chained together or scripted. Here are the key operators and patterns:

Chaining commands:

cmd

command1 && command2   :: Run command2 only if command1 succeeds
command1 || command2   :: Run command2 only if command1 fails
command1 & command2    :: Run both commands sequentially

Redirect output to a file:

cmd

systeminfo > C:\system_report.txt

Append output without overwriting:

cmd

echo Log entry >> C:\log.txt

Loop through files:

cmd

for %f in (*.txt) do echo %f

Simple batch script — Backup a folder:

batch

@echo off
set src=C:\MyFiles
set dest=D:\Backup
xcopy %src% %dest% /e /h /y
echo Backup complete!
pause

Save as .bat, double-click to run. This copies every file including hidden ones (/h) and overwrites without asking (/y).

CMD vs PowerShell vs Windows Terminal: Which Should You Use?

Many users ask whether CMD is still relevant when PowerShell and Windows Terminal exist. Here’s an honest breakdown:

FeatureCMDPowerShellWindows Terminal
Ease of use✅ Simple⚠️ Moderate✅ Modern UI
Scripting power⚠️ Basic✅ AdvancedDepends on shell
Object-based output❌ No✅ Yes✅ Yes
Cross-platform❌ Windows only✅ Yes✅ Yes
Legacy compatibility✅ Excellent⚠️ Some issues✅ Runs CMD
Learning curve✅ Low⚠️ Steeper✅ Low (it’s a wrapper)
Admin tasks✅ Strong✅ Stronger✅ Both

Bottom line: Use CMD for quick, universal tasks and legacy scripts. Switch to PowerShell for complex automation, remote management, and modern scripting. Use Windows Terminal as the interface that runs either one — it’s the best of both worlds.

10 Essential CMD Commands Every Windows User Should Know

If you’re short on time, these ten commands deliver the most value in everyday situations:

  1. ipconfig /flushdns — Fix stubborn website loading issues in seconds
  2. sfc /scannow — Repair corrupted Windows files without reinstalling
  3. ping 8.8.8.8 — Test internet connectivity instantly
  4. netstat -an — See every open port and connection on your machine
  5. tasklist — Find exactly what’s running and consuming resources
  6. systeminfo — Get a full system health snapshot
  7. chkdsk C: /f /r — Detect and fix hard drive errors
  8. netsh wlan show profiles — List every saved Wi-Fi network
  9. tree C:\ — Visualize your entire folder structure
  10. DISM /Online /Cleanup-Image /RestoreHealth — Rebuild a broken Windows image

CMD Commands Quick Reference Cheat Sheet

Navigation

cd [folder]          Change directory
cd ..                Go up one level  
dir                  List directory contents
cls                  Clear screen

Files

copy [src] [dest]    Copy file
move [src] [dest]    Move file
del [file]           Delete file
mkdir [name]         Create folder
rmdir /s /q [name]   Delete folder
ren [old] [new]      Rename file

Network

ipconfig /all        Show all IP info
ipconfig /flushdns   Flush DNS cache
ping [host]          Test connectivity
tracert [host]       Trace route
netstat -an          Show open ports
nslookup [domain]    DNS lookup

System

systeminfo           Full system info
tasklist             Running processes
taskkill /f /im      Kill process
sfc /scannow         Repair system files
chkdsk C: /f /r      Check disk
DISM /RestoreHealth  Repair Windows image

Frequently Asked Questions About CMD Commands

How do I run CMD as administrator in Windows 11?

Press Win + S, type Command Prompt, right-click the result, and select Run as administrator. Alternatively, press Win + X and choose Terminal (Admin) or Command Prompt (Admin) depending on your Windows version. You’ll see “Administrator:” in the title bar confirming elevated access. Many system-level CMD commands — including sfc, chkdsk, and netsh — require administrator privileges to function correctly.

What is the difference between CMD and PowerShell?

CMD (Command Prompt) is a basic command-line interpreter that processes simple text commands and batch scripts. PowerShell is a more advanced shell built on .NET that treats everything as objects, not plain text. PowerShell supports complex scripting, remote execution, and pipeline operations that CMD cannot handle. However, CMD remains faster for simple tasks and has broader compatibility with legacy systems and older batch files. For most everyday Windows tasks, CMD is sufficient.

How do I find my IP address using CMD commands?

Open Command Prompt and type ipconfig. Your IPv4 Address appears under your active network adapter. For a full breakdown including subnet masks, default gateway, and DNS server addresses, use ipconfig /all. To find your public IP address (the one websites see), use nslookup myip.opendns.com resolver1.opendns.com or visit a web-based IP tool.

Can CMD commands damage my computer?

Yes — if used incorrectly. Commands like format, del /f /s /q, and diskpart can permanently delete data or wipe drives without any confirmation dialog. Always double-check commands before running them, especially when operating as administrator. Never copy and paste CMD commands from untrusted sources — a technique called “pastejacking” can substitute hidden malicious commands that look harmless on screen. Stick to reputable references like this guide or Microsoft’s official documentation.

How do I stop a CMD command that is already running?

Press Ctrl + C to interrupt most running commands immediately. This sends a break signal to the current process. For commands that don’t respond to Ctrl + C, close the Command Prompt window or open Task Manager, find cmd.exe, and end the task. If a batch script is running, Ctrl + C will ask “Terminate batch job (Y/N)?” — type Y and press Enter.

What does the netsh wlan show profiles command do?

This command lists every Wi-Fi network your Windows PC has ever connected to. The profile names match the network SSIDs. To see the actual saved password for any profile, run: netsh wlan show profile name="ProfileName" key=clear and look for Key Content under Security Settings. This only works for networks saved on your machine and requires no special permissions on most systems.

Are CMD commands the same in Windows 10 and Windows 11?

Yes, the core CMD commands are essentially identical across Windows 10 and Windows 11. Both versions use the same underlying command interpreter (cmd.exe). Some newer commands related to Windows 11 features may not exist in Windows 10, and a few deprecated commands were removed or altered over time. For the vast majority of networking, file management, and system repair commands covered in this guide, the syntax and behavior are interchangeable between both versions.

Conclusion: The Power of CMD Is Still Real

The Windows Command Prompt has been dismissed as obsolete for years. It isn’t. CMD commands remain one of the most direct, reliable, and efficient ways to control your Windows environment — and learning them pays dividends whether you’re a student, a developer, a network administrator, or a curious power user.

Here are the key takeaways from this guide:

  • CMD is not obsolete. It’s a fast, universal tool built into every Windows installation with zero dependencies.
  • Network commands are your best friends. ipconfig, ping, tracert, and netstat solve the majority of everyday connectivity problems.
  • System repair commands save reinstalls. sfc /scannow and DISM /RestoreHealth can bring a broken Windows installation back to life.
  • Batch scripting multiplies your productivity. Combine CMD commands in .bat files to automate repetitive tasks at scale.
  • Respect the power. Commands like diskpart and format are irreversible. Always verify before you execute.

The best way to get better at CMD is to use it — open a command prompt right now and try systeminfo. You’ll immediately learn more about your own computer than most users ever discover through GUI menus.

Share This Article
Follow:
Antonio Partha bridges the gap between high-level engineering and everyday understanding. With a firm belief that technological literacy should be universal, Antonio has dedicated his career to building the world’s most accessible free technology encyclopedia.He writes with uncompromising authority and precision, translating dense documentation and complex digital concepts into clear, engaging insights. Whether he is decoding the latest advancements in machine learning or explaining the invisible infrastructure of the internet, Antonio’s work empowers millions of readers to navigate the digital age with confidence.