The Windows Command Prompt (CMD) is a powerful tool that allows users to interact with their operating system directly through text-based commands. Whether you’re a beginner or an advanced user, knowing these commands can help you troubleshoot issues, automate tasks, and manage your system more efficiently.
In this blog post, we’ve compiled a list of the top 100 CMD commands along with their descriptions and uses. Let’s dive in!
1. File Management Commands (1–30)
These commands help you manage files and directories, including creating, deleting, copying, and moving files.
# | Command | Description | Example |
---|---|---|---|
1 | cd |
Change the current directory. | cd C:\Users\YourName\Documents |
2 | dir |
List files and directories in the current directory. | dir |
3 | cls |
Clear the Command Prompt screen. | cls |
4 | copy |
Copy files from one location to another. | copy file.txt C:\Backup\ |
5 | xcopy |
Copy files and directories, including subdirectories. | xcopy C:\Source D:\Destination /s |
6 | move |
Move files from one location to another. | move file.txt C:\NewLocation\ |
7 | del |
Delete one or more files. | del file.txt |
8 | rmdir |
Remove a directory. | rmdir C:\OldDirectory |
9 | mkdir |
Create a new directory. | mkdir C:\NewDirectory |
10 | rename |
Rename a file or directory. | rename oldname.txt newname.txt |
11 | type |
Display the contents of a text file. | type file.txt |
12 | tree |
Display the directory structure in a tree format. | tree C:\ |
13 | attrib |
Display or change file attributes. | attrib +h file.txt |
14 | find |
Search for a text string in a file. | find "search term" file.txt |
15 | findstr |
Search for strings in files using regular expressions. | findstr "error" *.log |
16 | robocopy |
Robust file and folder copy tool. | robocopy C:\Source D:\Destination /mir |
17 | comp |
Compare the contents of two files or sets of files. | comp file1.txt file2.txt |
18 | compact |
Display or alter the compression of files on NTFS partitions. | compact /c file.txt |
19 | expand |
Extract files from a compressed file. | expand file.cab |
20 | fc |
Compare two files and display the differences. | fc file1.txt file2.txt |
21 | for |
Loop through a set of files or commands. | for %i in (*.txt) do echo %i |
22 | fsutil |
Perform advanced file system operations. | fsutil file createnew test.txt 1024 |
23 | ftype |
Display or modify file types used in file extension associations. | ftype txtfile |
24 | more |
Display output one screen at a time. | more file.txt |
25 | print |
Print a text file. | print file.txt |
26 | recover |
Recover readable information from a bad or defective disk. | recover C:\badfile.txt |
27 | replace |
Replace files in one directory with files of the same name in another. | replace C:\Old\file.txt C:\New |
28 | sort |
Sort input and display the result. | sort file.txt |
29 | takeown |
Take ownership of a file or folder. | takeown /f file.txt |
30 | where |
Locate and display files that match a search pattern. | where *.txt |
2. System Administration Commands (31–60)
These commands are used for managing system settings, services, and configurations.
# | Command | Description | Example |
---|---|---|---|
31 | chkdsk |
Check a disk for errors and repair them. | chkdsk C: /f |
32 | sfc |
System File Checker – scan and repair system files. | sfc /scannow |
33 | diskpart |
Manage disk partitions. | diskpart |
34 | format |
Format a disk. | format C: /fs:NTFS |
35 | systeminfo |
Display detailed system information. | systeminfo |
36 | ver |
Display the Windows version. | ver |
37 | whoami |
Display the current username. | whoami |
38 | net user |
Manage user accounts. | net user |
39 | net use |
Connect or disconnect network drives. | net use Z: \\Server\Share |
40 | net start |
Start a service. | net start wuauserv |
41 | net stop |
Stop a service. | net stop wuauserv |
42 | sc |
Manage Windows services. | sc query |
43 | schtasks |
Schedule tasks. | schtasks /create /tn "MyTask" /tr "C:\Script.bat" |
44 | reg |
Manage the Windows Registry. | reg query HKLM\Software\Microsoft |
45 | regsvr32 |
Register or unregister a DLL file. | regsvr32 mydll.dll |
46 | shutdown |
Shut down or restart the computer. | shutdown /s /t 0 |
47 | tasklist |
Display a list of currently running processes. | tasklist |
48 | taskkill |
Terminate a running process. | taskkill /im notepad.exe |
49 | driverquery |
Display a list of installed device drivers. | driverquery |
50 | gpresult |
Display Group Policy settings. | gpresult /r |
51 | gpupdate |
Update Group Policy settings. | gpupdate /force |
52 | icacls |
Display or modify Access Control Lists (ACLs) for files and directories. | icacls file.txt |
53 | logman |
Manage performance logs and alerts. | logman create counter MyLog |
54 | msiexec |
Install, modify, or repair Windows Installer packages. | msiexec /i package.msi |
55 | openfiles |
Display or disconnect open files. | openfiles /query |
56 | powercfg |
Configure power settings. | powercfg /hibernate off |
57 | setx |
Set environment variables permanently. | setx MyVar "MyValue" |
58 | vssadmin |
Manage Volume Shadow Copy Service. | vssadmin list shadows |
59 | wmic |
Windows Management Instrumentation Command-line tool. | wmic cpu get name |
60 | wevtutil |
Manage Windows Event Logs. | wevtutil qe System /c:10 |
3. Networking Commands (61–80)
These commands help you troubleshoot and manage network connections.
# | Command | Description | Example |
---|---|---|---|
61 | ipconfig |
Display IP configuration information. | ipconfig |
62 | ping |
Test network connectivity to another host. | ping google.com |
63 | tracert |
Trace the route packets take to a network host. | tracert google.com |
64 | netstat |
Display network connections, routing tables, and interface statistics. | netstat -a |
65 | nslookup |
Query DNS to obtain domain name or IP address mapping. | nslookup google.com |
66 | netstat -r |
Display the routing table. | netstat -r |
67 | pathping |
Trace network path and diagnose packet loss. | pathping google.com |
68 | getmac |
Display the MAC address of network adapters. | getmac |
69 | arp |
Display or modify the IP-to-Physical address translation tables. | arp -a |
70 | route |
Display or modify the network routing tables. | route print |
71 | netsh |
Configure network interfaces and settings. | netsh interface ip show config |
72 | telnet |
Connect to a remote computer using Telnet. | telnet 192.168.1.1 |
73 | tftp |
Transfer files using the Trivial File Transfer Protocol. | tftp -i 192.168.1.1 get file.txt |
74 | netstat -an |
Display all active connections and listening ports. | netstat -an |
75 | netstat -b |
Display the executable involved in creating each connection. | netstat -b |
76 | netstat -e |
Display Ethernet statistics. | netstat -e |
77 | netstat -s |
Display per-protocol statistics. | netstat -s |
78 | netstat -p |
Show connections for a specific protocol. | netstat -p tcp |
79 | netstat -n |
Display addresses and port numbers in numerical form. | netstat -n |
80 | netstat -o |
Display the process ID associated with each connection. | netstat -o |
4. Troubleshooting and Diagnostics Commands (81–100)
These commands help diagnose and resolve system issues.
# | Command | Description | Example |
---|---|---|---|
81 | chkdsk /r |
Check a disk for errors and repair them (includes bad sectors). | chkdsk C: /r |
82 | sfc /scannow |
Scan and repair system files. | sfc /scannow |
83 | dism |
Repair Windows images and components. | dism /online /cleanup-image /restorehealth |
84 | eventcreate |
Create a custom event in the Windows Event Log. | eventcreate /t ERROR /id 100 /l APPLICATION /d "Custom Error" |
85 | gpresult /h |
Save Group Policy results to an HTML file. | gpresult /h report.html |
86 | gpupdate /force |
Force an immediate update of Group Policy settings. | gpupdate /force |
87 | msinfo32 |
Launch the System Information tool. | msinfo32 |
88 | perfmon |
Launch the Performance Monitor tool. | perfmon |
89 | typeperf |
Write performance data to a log file. | typeperf "\Processor(_Total)\% Processor Time" |
90 | w32tm |
Manage Windows Time service. | w32tm /resync |
91 | wmic memorychip |
Display memory chip information. | wmic memorychip get capacity |
92 | wmic bios |
Display BIOS information. | wmic bios get serialnumber |
93 | wmic diskdrive |
Display disk drive information. | wmic diskdrive get model |
94 | wmic process |
Display running process information. | wmic process get name,processid |
95 | wmic service |
Display service information. | wmic service where name="wuauserv" get state |
96 | wmic startup |
Display startup programs. | wmic startup get caption,command |
97 | wmic qfe |
Display installed updates. | wmic qfe get hotfixid |
98 | wmic cpu |
Display CPU information. | wmic cpu get name |
99 | wmic os |
Display operating system information. | wmic os get version |
100 | wmic product |
Display installed software. | wmic product get name |
Why Learn These Commands?
- Efficiency: Automate repetitive tasks and save time.
- Troubleshooting: Diagnose and fix system issues quickly.
- Advanced Management: Gain more control over your system and network.
- Scripting: Create batch files to automate complex workflows.
This list covers a wide range of commands for file management, system administration, networking, and troubleshooting. By mastering these commands, you can unlock the full potential of the Windows Command Prompt and streamline your workflow. Happy commanding! 🚀