SEARCH
— 葡萄酒 | 威士忌 | 白兰地 | 啤酒 —
— 葡萄酒 | 威士忌 | 白兰地 | 啤酒 —
In daily computer management and maintenance work, the Command Prompt (CMD) plays an indispensable role.
CMD is not just a simple text interface but a powerful system management tool. Through simple command-line instructions, we can achieve various functions such as network configuration, system management, resource sharing, and more.
Simply press the shortcut key Win+R, type `cmd` and hit Enter, then input CMD commands.
For me, I often use CMD commands to check if TCP ports are functioning correctly, such as using `telnet IP address port number` for testing.
What’s your favorite CMD command?
Today, let’s talk about some of the most commonly used CMD commands, simple yet quick and versatile, capable of handling many situations in your work. If you don’t know them yet, use them after reading this article. Don’t fall behind!
Today’s Article Reading Bonus: “CMD Command Encyclopedia
I’ll share a must-have useful resource for your work. Save it for later use. Send me a private message with the code “CMD” to get it on a limited-time basis.
01 ipconfig: Network Configuration at a Glance
`ipconfig` is a powerful tool for displaying the TCP/IP configuration information of all adapters on the local computer. It can be used to view key network parameters such as IP address, subnet mask, and default gateway.
01 Basic Syntax
“`cmd
ipconfig [options]
“`
02 Examples
Use `ipconfig /all` to get detailed network configuration information:
“`cmd
C:\>ipconfig /all
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : example.com
Link-local IPv6 Address . . . . . : fe80::1234:abcd:efgh:ijkl%10
IPv4 Address. . . . . . . . . . . : 192.168.1.100
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
“`
View the IP address assigned by the DHCP server:
“`cmd
C:\>ipconfig /release
C:\>ipconfig /renew
Windows IP Configuration
Ethernet adapter Local Area Connection:
DHCP enabled . . . . . . . . . . . : Yes
DHCP server . . . . . . . . . . . : 192.168.1.1
DHCP lease obtained . . . . . . . : Tuesday August 27 16:45:01 2024
DHCP lease expires . . . . . . . . : Wednesday August 28 16:45:01 2024
“`
02 msg: Quick Way to Send System Messages
The `msg` command allows users to send messages to users or sessions on local or remote computers. This is very useful for quick notifications or reminders.
01 Basic Syntax
“`cmd
msg [options] <username|sessionname> [message]
“`
02 Examples
Send a message to all logged-in users:
“`cmd
C:\>msg * Hello, this is a test message.
“`
Send a message to a specific user:
“`cmd
C:\>msg user1 Please check your email for important updates.
“`
Send a message to a specific session:
“`cmd
C:\>msg \\computername\sessionname Message for the user of computername.
“`
03 net user: User Account Management Tool
The `net user` command is used to display or change user account settings. It is an important tool for managing user accounts, allowing the creation of new users, modification of user attributes, password resets, and more.
01 Basic Syntax
“`cmd
net user [options]
“`
02 Examples
List all user accounts:
“`cmd
C:\>net user
“`
Create a new user:
“`cmd
C:\>net user newuser Password123 /add
“`
Modify user attributes (e.g., disable account):
“`cmd
C:\>net user newuser /active:no
“`
Reset user password:
“`cmd
C:\>net user newuser * /passwordchg:no
“`
04 net share: Shared Resource Management Tool
The `net share` command is used to display, create, delete, or modify shared resources. This allows administrators to easily manage and configure network shares, enabling file and printer sharing.
01 Basic Syntax
“`cmd
net share [options]
“`
02 Examples
List all shared resources:
“`cmd
C:\>net share
“`
Create a shared folder:
“`cmd
C:\>net share foldername=c:\folder /public
“`
Delete a shared resource:
“`cmd
C:\>net share foldername /delete
“`
05 nslookup: DNS Query Tool
The `nslookup` command is used to query DNS server information. It helps diagnose DNS issues, such as resolving domain names to IP addresses and checking DNS records.
01 Basic Syntax
“`cmd
nslookup [options] <hostname>
“`
02 Examples
Query the IP address corresponding to a domain name:
“`cmd
C:\>nslookup www.example.com
Server: UnKnown
Address: 192.168.1.1
Non-authoritative answer:
Name: www.example.com
Addresses: 93.184.216.34
“`
Specify a DNS server for querying:
“`cmd
C:\>nslookup -server 8.8.8.8 www.example.com
Server: 8.8.8.8
Address: 8.8.8.853
Non-authoritative answer:
Name: www.example.com
Addresses: 93.184.216.34
“`
06 netsh wlan show: Wireless Network Configuration Management
The `netsh wlan show` command is used to display wireless network configuration information. This includes viewing saved Wi-Fi profiles and detailed information about wireless network adapters.
01 Basic Syntax
“`cmd
netsh wlan show [options]
“`
02 Examples
List all stored Wi-Fi profiles:
“`cmd
C:\>netsh wlan show profiles
All User Profile : NetworkName
Key Content : Not Available
“`
View Wi-Fi password:
“`cmd
C:\>netsh wlan show profile name=”NetworkName” key=clear
Key Content : ********
“`
Display detailed information about wireless network adapters:
“`cmd
C:\>netsh wlan show interface
Interface Description : Wireless Network Connection
Physical Address : 00-11-22-33-44-55
SSID : NetworkName
BSSID : 11-22-33-44-55-66
State : Connected
“`
07 telnet: Remote Access and Debugging Tool
The `telnet` command is used to test network connections and remote access. It can connect to remote servers via the TCP protocol and conduct interactive sessions or send data.
01 Basic Syntax
“`cmd
telnet [options] <hostname> <port>
“`
02 Examples
Test if the HTTP service is available:
“`cmd
C:\>telnet www.example.com 80
Trying 93.184.216.34…
Connected to www.example.com.
Escape character is ‘^]’.
GET / HTTP/1.1
Host: www.example.com
“`
Test if the SMTP service is available:
“`cmd
C:\>telnet mail.example.com 25
Trying 93.184.216.35…
Connected to mail.example.com.
Escape character is ‘^]’.
EHLO client.example.com
“`
08 Pipe (|): Data Stream Control Operator
The pipe (`|`) is an operator used to pass the output of one command as input to another command. This allows us to combine multiple commands to complete complex data processing tasks.
01 Basic Syntax
“`cmd
command1 | command2
“`
02 Examples
Find the IPv4 address in the `ipconfig` output:
“`cmd
C:\>ipconfig | find “IPv4 Address”
IPv4 Address. . . . . . . . . . . : 192.168.1.100
“`
Find a specific user in the `net user` output:
“`cmd
C:\>net user | find “newuser”
newuser Disabled account
“`
09 Logical Operator (&&): Conditional Execution Control
The logical operator (`&&`) is used to control the execution order of commands. If the previous command executes successfully, the subsequent command will be executed. This is a very useful conditional execution mechanism, especially when writing batch scripts.
01 Basic Syntax
“`cmd
command1 && command2
“`
02 Examples
Flush the DNS cache and re-register DNS names:
“`cmd
C:\>ipconfig /flushdns && ipconfig /registerdns
Windows IP Configuration
Successfully flushed the DNS Resolver Cache.
Successfully renewed all addresses.
“`
Set user permissions after successfully creating a user:
“`cmd
C:\>net user newuser Password123 /add && net user newuser /active:yes
The command completed successfully.
The command completed successfully.
“`
Dive into the world of 4G industrial routers, their crucial interfaces, and their pivotal role in shaping the future of smart manufacturing. Discover how these devices are driving the digital transformation of factories.
View detailsAn in-depth analysis of how to select industrial 4G modems, highlighting key parameters and personal insights from an experienced engineer's perspective.
View detailsAs a technical support specialist at Yeaplink, I'm excited to present a detailed assessment of our SR520 4G LTE industrial router. This cutting-edge device represents a significant advancement in industrial connectivity solutions. Let's explore th...
View detailsFirst, let's understand that modern vehicles are essentially rolling computers. Consequently, they contain dozens of electronic control units (ECUs).Naturally, these ECUs need to communicate efficiently. Therefore, the automotive gateway system pl...
View detailsMo