Essential Windows CMD Commands: A Curated Reference
This guide compiles over 100 of the most useful Windows Command Prompt commands, organized into eight categories with clear explanations and practical examples for file management, system information, disk maintenance, networking, process control, scripting, security, and handy utilities.
1️⃣ File and Directory Management
dir: Displays the list of files and folders in the current directory. Example:
dir C:\Windowscd: Changes the current directory path. Example:
cd ..md/ mkdir: Creates a new folder. Example:
md NewFolderrd/ rmdir: Removes an empty directory. Example:
rd OldFoldertree: Shows the folder hierarchy as a tree. Example:
tree D:\copy: Copies a file to a specified location. Example:
copy a.txt D:\Backup\xcopy: Copies files and directory trees. Example:
xcopy /E Source Targetrobocopy: Advanced copy tool with mirroring and resume support. Example:
robocopy C:\Source D:\Target /MIRmove: Moves or renames a file or directory. Example:
move a.txt ..\Other\del/ erase: Deletes files (supports wildcards). Example:
del *.tmpren/ rename: Renames a file or folder. Example:
ren old.txt new.txttype: Displays the content of a text file directly in the console. Example:
type log.logattrib: Shows or modifies file attributes (read‑only, hidden, etc.). Example:
attrib +H hiddenfile.txtassoc: Views or changes file‑extension associations. Example:
assoc .txtcomp: Compares the contents of two files. Example:
comp a.txt b.txtfind: Searches for a specific string within files. Example:
find "error" log.logfindstr: Advanced search supporting regular expressions. Example:
findstr /S "hello" *.txtreplace: Replaces files in a target directory with those from a source directory. Example:
replace C:\Source\*.txt D:\Target\2️⃣ System Information and Management
systeminfo: Shows an overview of OS version, hardware configuration, etc. Example:
systeminfowinver: Pops up a window displaying the Windows version number. Example:
winverver: Prints the OS version in the console. Example:
verhostname: Shows the computer's network name. Example:
hostnamewhoami: Displays the currently logged‑in user name. Example:
whoamidriverquery: Lists installed drivers. Example:
driverquery /Vmsinfo32: Opens the graphical System Information panel. Example:
msinfo32set: Shows or sets environment variables. Example:
set PATHdate: Displays or sets the system date. Example:
datetime: Displays or sets the system time. Example:
timeshutdown: Shuts down, restarts, or schedules power actions. Example:
shutdown /s /t 36003️⃣ Disk Management and Maintenance
diskpart: Enters the disk partitioning tool. Example:
diskpart → list diskchkdsk: Checks disk errors and attempts repairs. Example:
chkdsk C: /Fformat: Formats a disk partition. Example:
format D: /FS:NTFSvol: Shows volume label and serial number. Example:
vol D:label: Creates or changes a volume label. Example:
label D: DataDiskdefrag: Defragments a disk. Example:
defrag C: /Oconvert: Converts a FAT volume to NTFS without data loss. Example:
convert D: /FS:NTFSfsutil: Advanced file‑system management tool. Example:
fsutil fsinfo driveswmic: Queries disk model, size, etc., via WMI. Example:
wmic diskdrive get model,size4️⃣ Network Diagnosis and Configuration
ipconfig: Shows IP address and network configuration. Example:
ipconfig /allping: Tests network connectivity. Example:
ping baidu.com -ttracert: Traces route hops. Example:
tracert baidu.comnetstat: Displays network connections and listening ports. Example:
netstat -annslookup: Queries DNS records. Example:
nslookup baidu.comarp: Shows the ARP cache table. Example:
arp -agetmac: Shows network adapter MAC addresses. Example:
getmac /Vroute: Views or modifies the routing table. Example:
route printpathping: Traces route with latency statistics. Example:
pathping baidu.comftp: Enters FTP file‑transfer mode. Example:
ftp ftp.example.comnbtstat: Shows NetBIOS over TCP/IP statistics. Example:
nbtstat -nnetsh: Network configuration scripting tool (reset network, view Wi‑Fi passwords, etc.). Example:
netsh wlan show profile5️⃣ Process and Task Management
tasklist: Lists all running processes. Example:
tasklisttaskkill: Forces termination of a specific process. Example:
taskkill /F /IM notepad.exeschtasks: Manages scheduled tasks. Example:
schtasks /Querywmic process: Views process details via WMI. Example:
wmic process list briefstart: Launches a new window to run a program. Example:
start notepad.exerunas: Runs a program under a different user account. Example:
runas /user:Administrator cmd6️⃣ Batch and Automation Scripting
echo: Displays a message or toggles command echoing. Example:
echo Processing complete!@: Hides the command itself from being echoed. Example:
@echo offpause: Pauses execution and prompts "Press any key to continue". Example:
pauserem: Adds a comment line. Example:
rem This is a commentcall: Calls another batch file and returns. Example:
call anotherScript.batgoto: Jumps to a specified label. Example:
goto :endif: Conditional statement. Example:
if exist file.txt del file.txtfor: Loops over files or collections. Example:
for %f in (*.txt) do echo %fset: Defines or interactively inputs variables. Example:
set /P name=Enter name:exit: Exits the script or command interpreter. Example:
exit /bcolor: Sets console foreground and background colors. Example:
color 0Atitle: Sets the CMD window title. Example:
title My Automation Tool7️⃣ User, Permissions and Security
net user: Manages local user accounts. Example:
net user NewUser Password /addnet localgroup: Manages local user groups. Example:
net localgroup Administrators User /addnet share: Manages shared folders. Example:
net share ShareName=C:\Foldernet use: Connects or disconnects network drives. Example:
net use Z: \\Server\Sharenet accounts: Views account password policies. Example:
net accountstakeown: Takes ownership of a file or folder. Example:
takeown /F ProtectedFile.txticacls: Shows or modifies file ACLs. Example:
icacls Folder /grant Username:Fcipher: Encrypts or decrypts NTFS files. Example:
cipher /E Secret.docx8️⃣ Handy Utilities
cls: Clears the screen. Example:
clsexit: Closes the CMD window. Example:
exithelp: Shows a list of commands or help for a specific command. Example:
help copy/?: Shows detailed syntax for any command. Example:
ping /?cmd: Starts a new command session. Example:
cmd /kpowershell: Switches to PowerShell environment. Example:
powershellnotepad: Opens Notepad. Example:
notepadcalc: Opens Calculator. Example:
calcosk: Opens On‑Screen Keyboard. Example:
oskcontrol: Opens Control Panel. Example:
controltaskmgr: Opens Task Manager. Example:
taskmgrregedit: Opens Registry Editor. Example:
regeditgpedit.msc: Opens Group Policy Editor. Example:
gpedit.mscservices.msc: Opens Services management console. Example:
services.msceventvwr: Opens Event Viewer. Example:
eventvwrmsconfig: Opens System Configuration utility. Example:
msconfigmstsc: Opens Remote Desktop Connection. Example:
mstscdxdiag: Opens DirectX Diagnostic Tool. Example:
dxdiagcleanmgr: Opens Disk Cleanup tool. Example: cleanmgr Quick Tips:
Press Win + R, type cmd, and hit Enter to open Command Prompt quickly. Use Win + X and select "Terminal (Admin)" for elevated rights.
Right‑click inside a CMD window to paste content.
Append /? to any command to view detailed syntax, e.g., copy /?.
Remember to separate commands, parameters, and paths with spaces.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
