CMD - Command Prompt is an interface application used for executing batch files, swiftly performing tasks, aiding in troubleshooting, and resolving various Windows issues when the system encounters problems. However, not all commands in Windows are useful and frequently executed. In this article, Mytour compiles a list of commonly used and practical CMD commands in Windows 10 for your reference.
To open Command Prompt, press Windows + R to open the Run dialog, then type cmd and press Enter.
Here are some common commands in CMD:
1. PING Command.
Purpose: Use the PING command to check if a computer is connected to the network. The PING command sends packets from your computer to the destination computer, allowing you to determine the status of the connection or if the computer is connected.
Syntax: ping ip/host/[/t][/a][/l][/n]
- Ip: IP address of the machine to check; host is the name of the computer to check network connectivity (can use IP address or computer name).
- /t: utilized for continuous 'pinging' to the target computer, press Ctrl + C to stop.
- /a: resolves IP address from the computer name (host).
- /l: determines the width of the outgoing packet for inspection.
- /n: Specifies the number of packets sent out.
2. Tracert Command.
Purpose: The command helps you visualize the route of packets from your computer to the target computer, showing which servers or routers the packets pass through...
Syntax: tracert ip/host
- ip/host: IP address/hostname.
3. Netstat Command.
Purpose: Lists the incoming and outgoing connections to your computer.
Syntax: Netstat [/a][/e][/n]
- /a: Displays all connections and listening ports.
- /e: Provides Ethernet statistics.
- /n: Displays addresses and connection port numbers.
You can refer to additional parameters by typing Netstat/?
4. Ipconfig Command.
Purpose: Displays the IP configuration of your computer (hostname, IP address, DNS…).
Syntax: ipconfig /all
5. Shutdown Command.
Purpose: Shuts down and restarts the computer.
Syntax (Windows 7):
- Shutdown: Shutdown -s -t [a]
- Restart computer: Shutdown -r -t [a]
+ a: shutdown time (in seconds).
6. DIR Command.
Purpose: View files and folders.
Syntax: DIR [drive:] [path][filename]
- Path: The location of the file or folder.
- Filename: File name.
7. DEL Command.
Purpose: Delete file.
Syntax: DEL [/p][/f][/s][/q][/a[[:]attributes]] 'file name to delete'
- /p: Display file information before deletion.
- /f: Delete files with read-only attribute.
- /s: Delete that file in all directories containing it.
- /q: Delete without asking.
- /a[[:]attributes]: Delete based on file attributes (R: Read-only files, S: System files, H: Hidden files).
Delete all files *.*
8. COPY Command.
Purpose: Copy files from one directory to another on the computer.
Syntax: COPY 'source address' 'destination address' /y
- /y: Copy without asking.
9. RD Command.
Purpose: The RD command helps you delete directories.
Syntax: RD /s /q 'directory to delete'
- /s: Delete entire directory.
- /q: Delete without asking.
10. MD Command.
Purpose: Create a new directory.
Syntax: MD 'path to save the created folder'\'folder name to create'
Example: md 'C:\documents' (creates documents folder in drive C).
11. TASKKILL Command.
Purpose: Terminate a running application.
Syntax: taskkill /f /im 'application name'.exe.
Example: taskkill /f /im Skype.exe (terminate Skype application).
12. REG ADD Command.
Purpose: Create, modify Registry entries.
Syntax: REG ADD KeyName [/v ValueName] [/t Type] [/s Separator] [/d Data] [/f]
- KeyName: Path to the Key.
- /v ValueName: Name of the value to create.
- /t Type: Data type.
- /d Data: Value.
13. REG DELETE Command.
Purpose: Delete a value in the Registry.
Syntax: REG DELETE KeyName [/v ValueName] [/f]
- [/v ValueName]: Name of the value to delete.
14. REGEDIT.EXT Command.
Purpose: Run .reg file.
Syntax: Regedit.exe /s 'location of .reg file'
- /s: No prompt.
15. ATTRIB Command.
Purpose: Set attributes for files, folders.
Syntax: ATTRIB -a -s -h -r 'file, directory' /s /d
or ATTRIB +a +s +h +r 'file, directory' /s /d
- Plus sign +: Add attribute.
- Minus sign -: Remove attribute.
- a: Archive (storage attribute).
- s: System (system attribute).
- h: Hidden (hidden attribute).
- r: Read-only (read-only attribute).
- /s: Applies to all files in the directory and subdirectories.
- /d: Set attributes for directories and subdirectories.
Above are some useful and common CMD commands introduced by Mytour. Thank you for following the article!