The Windows Command Prompt (cmd) provides many commands for performing various system administration tasks, file operations, network configuration, and more. The following are some commonly used commands, classified according to function:
1. File and directory operation commands:
dir
: List files and subdirectories in the current directory.- Example:
dir /s
command to list all files and subdirectories in the current directory and its subdirectories.
2. File operation commands:
copy
: Copy a file or directory.- Example:
copy file1.txt file2.txt
The command copies file1.txt to file2.txt.
3. Directory operation command:
cd
: Change the current directory.- Example:
cd Documents
The command changes the current directory to the Documents folder. - Add the parameter /d_ to directly enter the specified drive letter
- Example: To enter the C:\Users directory under the C drive, enter cd /d C:\Users
4. System information command:
systeminfo
: Display the detailed information of the system.- Example:
systeminfo | findstr /C:"OS Name"
command to display the name of the operating system.
5. Network operation command:
ping
: Send an ICMP echo request to the specified host.- Example:
ping www.google.com
Command to check connection to Google.
6. Process management commands:
tasklist
: Displays a list of currently running processes.- Example:
tasklist | findstr chrome.exe
command to find and display all processes named chrome.exe.
7. Network configuration command:
diskpart
: Open the disk partition tool.- Example:
diskpart
The command opens the interactive interface of the disk partition tool.
8. User management commands:
net user
: Manage user accounts.- Example:
net user username password /add
command to create a new user account.
10. Service management command:
sc
: Manage system services.- Example:
sc start servicename
The command starts the specified service.
help
commands Get a list of commands available on the current system. This command displays a brief description of the commands built into the operating system. You can also view help information for a specific command by using /?
the parameter . For example, to view help for dir
the command , enter dir /?
.
File and directory operation commands:
dir
: List files and subdirectories in the current directory.cd
: Change the current directory.mkdir
: Create a new directory.copy
: Copy files.del
:Delete Files.move
: Move the file or rename the file.- Example: To copy a file
source.txt
to a target directorydestination
, the command can be usedcopy source.txt destination
.
System information command:
systeminfo
: Display the detailed information of the system, including OS version, installation date, etc.hostname
: Displays the hostname of the computer.ipconfig
: Display the network configuration information of the computer.tasklist
: Displays a list of currently running processes.- Example: To view a list of currently running processes, the command can be used
tasklist
.
Network command:
ping
: Send an ICMP echo request to the specified IP address or domain name to test the network connection.tracert
: Trace the routing path of a packet from the local computer to the destination address.ipconfig
: Display the network configuration information of the computer.netstat
: Display network connection and network statistics.- Example: To test the network connection to the target server, the command can be used
ping www.example.com
.
Security command:
net user
: Manage local user accounts, such as creating new users, changing passwords, etc.net share
: Manage shared folders and printers.cipher
: Perform encryption, decryption, and key export operations on the specified file or directory.sfc /scannow
: Scan and fix system file integrity issues.- Example: To create a new user account
newuser
named , the command can be usednet user newuser password /add
.