Windows CMD Commands List: 70+ Essential Commands With Examples and Safety Notes

Discover over 70 vital Windows CMD commands every user should know, from basic file operations to advanced system administration tools. This guide explains how to use each command with clear categories, practical use cases, and a reference table, making it ideal for beginners, IT professionals, and system administrators who want to boost productivity and take full control of their Windows environment.

May 10, 2025 - 12:30
Updated: 1 month ago
107.2k
Windows CMD Commands List: 70+ Essential Commands With Examples and Safety Notes

Quick answer: Essential Windows CMD commands include dir, cd, copy, robocopy, ipconfig, ping, tracert, nslookup, netstat, tasklist, taskkill, chkdsk, sfc /scannow and net user. Add /? to any command for help. Be careful with del /s, format, diskpart clean, reg delete and bcdedit, which can destroy data or stop Windows booting.

Key takeaways

  • Learn commands by group: files, system, network, disk, processes, users and repair.
  • ipconfig, ping, tracert and nslookup form a quick network troubleshooting sequence.
  • Know the destructive commands: del /s, format, diskpart clean, reg delete, bcdedit.
  • wmic is deprecated; PowerShell is better for automation.

How do you use this list?

Open Command Prompt from the Start menu. For commands marked "admin", right-click it and choose Run as administrator. Add /? to any command, for example robocopy /?, to see its built-in help. This list covers the commands worth knowing, in groups, with a note where a command can hurt you.

Files and folders

CommandWhat it doesExample
dirList files and foldersdir /a (include hidden)
cdChange foldercd C:\Users; cd /d D:\ to switch drive
cd..Go up one levelcd..
md / mkdirCreate a foldermkdir reports
rd / rmdirRemove an empty folder (/s removes contents too: dangerous)rmdir old
copyCopy filescopy a.txt b.txt
xcopyCopy folders and treesxcopy src dest /e /i
robocopyReliable copy tool for large jobs and backupsrobocopy C:\data D:\backup /e
moveMove or renamemove a.txt D:\
ren / renameRenameren old.txt new.txt
del / eraseDelete files (no Recycle Bin)del file.txt
typeShow a text filetype log.txt
morePage through outputtype big.txt | more
findSearch for text in filesfind "error" log.txt
findstrSearch with patternsfindstr /i /s "timeout" *.log
treeShow folder structuretree /f
attribShow or change file attributesattrib +h secret.txt
fcCompare two filesfc a.txt b.txt
mklinkCreate a symbolic linkmklink link.txt target.txt
clsClear the screencls

System information

CommandWhat it doesExample
verWindows versionver
systeminfoDetailed system and patch informationsysteminfo
hostnameComputer namehostname
whoamiCurrent user (/groups shows groups)whoami /groups
setShow environment variablesset PATH
wmicLegacy hardware and OS queries; deprecated, use PowerShell insteadwmic cpu get name
driverqueryList installed driversdriverquery
date / timeShow or set date and timedate /t
echoPrint text or set echo in scriptsecho Hello
helpList commands or show helphelp copy

Networking

CommandWhat it doesExample
ipconfigIP settings (/all for details, /release and /renew for DHCP, /flushdns to clear DNS cache)ipconfig /all
pingTest reachabilityping 8.8.8.8
tracertTrace the route to a hosttracert example.com
pathpingTrace plus packet loss per hoppathping example.com
nslookupQuery DNSnslookup example.com
netstatConnections and listening portsnetstat -ano
arpARP tablearp -a
routeShow or edit the routing tableroute print
getmacMAC addressesgetmac /v
netshConfigure network components, Wi-Fi and firewallnetsh wlan show profiles
net useMap or disconnect network drivesnet use Z: \\server\share
nbtstatNetBIOS informationnbtstat -n

A good first troubleshooting sequence for "no internet": ipconfig /all (is there an address and gateway?), ping the gateway, ping 8.8.8.8, then nslookup example.com. Each step tells you which layer is failing.

Disks and drives

CommandWhat it doesExample
chkdskCheck a drive for errorschkdsk C: /f (needs admin, may need reboot)
diskpartDisk partitioning tool; powerful and dangerousdiskpart then list disk
formatFormat a drive: erases dataformat E: /fs:ntfs
volShow a drive's label and serial numbervol C:
labelChange a drive labellabel E: DATA
fsutilFile system utilitiesfsutil volume diskfree C:
defragOptimise drives (/O)defrag C: /O
cleanmgrOpen Disk Cleanupcleanmgr
compactCompress files on NTFScompact /c file.txt

Processes, services and tasks

CommandWhat it doesExample
tasklistList running processestasklist /fi "imagename eq chrome.exe"
taskkillEnd a processtaskkill /pid 1234; /f forces it
startLaunch a program or filestart notepad
scManage servicessc query
net start / net stopStart or stop a servicenet stop spooler
schtasksCreate and manage scheduled tasksschtasks /query
atOld task scheduler; use schtasks-
perfmonOpen Performance Monitorperfmon
eventvwrOpen Event Viewereventvwr
wevtutilQuery event logswevtutil qe System /c:5 /f:text

Users, permissions and policy

CommandWhat it doesExample
net userList or manage local usersnet user
net localgroupManage local groupsnet localgroup administrators
runasRun a program as another userrunas /user:admin cmd
icaclsShow or change file permissionsicacls C:\data
takeownTake ownership of a filetakeown /f file.txt
gpupdateRefresh Group Policygpupdate /force
gpresultShow applied policiesgpresult /r
cipherEncrypt files or wipe free space (/w is slow and destructive)cipher /?
klistKerberos ticketsklist

Repair, power and miscellaneous

CommandWhat it doesExample
sfc /scannowCheck and repair protected system filesRun as administrator
DISM /Online /Cleanup-Image /RestoreHealthRepair the Windows image, then run sfc againRun as administrator
shutdownShut down or restart (/s, /r, /t seconds, /a aborts)shutdown /r /t 60
bcdeditBoot configuration: wrong changes can stop Windows bootingbcdedit /enum
regRead or edit the registryreg query HKCU\Software
powercfgPower settings and battery reportpowercfg /batteryreport
msinfo32System Information windowmsinfo32
winverShow Windows version dialogwinver
mstscRemote Desktop clientmstsc /v:server
assoc / ftypeFile type associationsassoc.txt
title, color, promptCustomise the consolecolor 0a

What are the commands that can destroy data or break Windows?

Read the help and be certain of the target before running these.

  • del /s /q and rd /s /q delete without asking and skip the Recycle Bin.
  • format and diskpart with clean wipe drives. A wrong disk number is unrecoverable.
  • reg delete and careless reg add can break applications or Windows itself. Export a key first with reg export.
  • bcdedit changes can leave the PC unbootable.
  • taskkill /f on system processes can crash Windows.
  • cipher /w overwrites free space and takes a long time.
  • shutdown /r /t 0 restarts immediately and unsaved work is lost.

Pipes, redirection and a tiny batch file

Use > to send output to a file, >> to append, and | to pass output to another command.

ipconfig /all > C:\temp\net.txt
tasklist | findstr /i "chrome"

A simple backup script saved as backup.bat:

@echo off
set SRC=C:\Users\%USERNAME%\Documents
set DST=D:\Backup\Documents
robocopy "%SRC%" "%DST%" /e /r:2 /w:5
echo Done at %date% %time%

CMD or PowerShell?

CMD is fine for quick tasks and old scripts. PowerShell works with objects, has far more features and is what Microsoft develops for administration, and some older tools such as wmic are deprecated. Learn both: CMD for speed, PowerShell for automation. Microsoft's documentation is at Microsoft Learn.

Next steps

For Linux commands, see the top 100 Linux commands and the Linux command cheat sheet. To turn command-line skills into a career, see the Computer Network course.

Related reading

Frequently Asked Questions

The most useful include dir, cd, copy, robocopy, ipconfig, ping, tracert, nslookup, netstat, tasklist, taskkill, chkdsk, sfc /scannow, and net user. Together they cover files, networking, processes, repair and accounts.

Search for Command Prompt in the Start menu, right-click it and choose Run as administrator. Commands such as chkdsk /f, sfc /scannow and DISM need administrator rights.

Run ipconfig /all to check the address and gateway, ping the gateway, then ping 8.8.8.8, then nslookup a name. If needed, use ipconfig /release, ipconfig /renew and ipconfig /flushdns.

Commands such as del /s /q, rd /s /q, format, diskpart clean, reg delete, bcdedit changes and taskkill /f on system processes can destroy data or stop Windows working. Check the target first and keep backups.

CMD is the older command line for simple tasks and legacy scripts. PowerShell works with objects, has far richer features and is the main tool for modern Windows administration. Many CMD tools such as wmic are deprecated.

Open CMD as administrator and run sfc /scannow. If it reports problems it cannot fix, run DISM /Online /Cleanup-Image /RestoreHealth, then run sfc /scannow again and restart.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.