A complete collection of common Dos commands and explanations

Table of contents

Preface

1. System information

2. Network

3. Users

4. Port process service

5. Sharing

6. File operations

Summarize



Preface

DOS is the abbreviation of "Disk Operating System". It is an early operating system that was first widely used on personal computers in the 1980s. DOS is mainly used to control computer hardware and manage file systems, and provides a set of command line interfaces (CLI) for users to interact with the operating system. A well-known version of DOS is Microsoft's MS-DOS, which is the primary operating system used in IBM PCs and compatibles. With the rise of graphical user interfaces, DOS was gradually replaced by more advanced operating systems such as Windows.

This article divides some commonly used Dos commands into six parts: system information, network, users, port process services, sharing, and file operations, so that readers can read them better. Please see the text for details of commonly used Dos commands and explanations.


DOS commands are used to perform various operations such as managing files and folders, performing system maintenance tasks, running programs, etc. Although modern operating systems provide more friendly and graphical user interfaces, understanding and mastering DOS commands is still very beneficial for a deep understanding of computer technology and application in certain specific scenarios. The following are commonly used Dos commands and explanations:

1. System information

  1. CHCP 65001: This command is used to set the font encoding of the console to UTF-8 to support the display of Unicode characters.

  2. systeminfo: This command is used to display detailed system information of the computer, including operating system version, installation date, physical memory, etc.

  3. hostname: This command is used to view the host name of the computer. A hostname is a name used to identify a computer on a network.

  4. SET: This command is used to view and set environment variables. Environment variables are parameters used to store operating system and application configuration information.

  5. color: This command is used to change the color of the command line window. You can set the foreground and background colors by specifying two hexadecimal digits. For example: color 0Ameans black background and green foreground.

  6. cls: This command is used to clear all text in the command line window and make the screen blank.

  7. runas /user:administrator cmd: This command is used to open a new command line window as an administrator. When executing this command, you will be prompted for the administrator password.

2. Network

  1. ipconfig /all: This command is used to display the complete network information of the computer, including IP address, subnet mask, default gateway, DNS server, etc.

  2. ping -t -l 65500 ip: This command is used to perform a "ping of death", which can send large data packets to test the stability of the network connection. Among them, -tmeans sending continuous pings, -l 65500means setting the packet size to 65500 bytes, ipwhich is the target IP address. For example:ping -t -l 65500 192.168.0.1

  3. ipconfig /release: This command is used to release the IP address of the current computer.

  4. ipconfig /renew: This command is used to reacquire the IP address.

  5. ipconfig /flushdns: This command is used to clear the cache of the DNS resolver.

  6. ipconfig /displaydns: This command is used to display the contents of the DNS resolver cache.

  7. route print: This command is used to print the routing information of the current computer, including network targets, gateways, interfaces, etc.

  8. arp -a: This command is used to view the computer's ARP cache and display the IP and MAC addresses of other devices connected to the machine.

  9. net view: This command is used to view the names of other computers in the current LAN.

  10. netsh firewall show state: This command is used to display the status information of the firewall, including enabling status, configuration policy, etc.

  11. netsh firewall show config: This command is used to display the firewall rule configuration information, including inbound rules, outbound rules, etc.

3. Users

  1. net config workstation: This command is used to view the configuration information of the currently logged in user, including user name, domain name, etc.

  2. whoami: This command is used to display the username of the currently logged in user.

  3. net user: This command is used to view the list of users existing in the system.

  4. net user supermage: This command is used to view the detailed information of the user named supermage.

  5. net localgroup: This command is used to view group information in the system.

  6. net localgroup administrators: This command is used to view detailed information of the group named administrators.

  7. net user hack 123 /add: This command is used to create a user named hack and set the password to 123.

  8. net user hack$ 123 /add: This command is used to create a hidden user named hack and set the password to 123.

  9. net user hack /del: This command is used to delete the user named hack.

  10. net localgroup administrators hack /add: This command is used to promote an ordinary user named hack to an administrator.

  11. net user guest /active:yes: This command is used to activate the user named guest.

  12. net user guest /active:no: This command is used to disable the user named guest.

  13. net password 密码: This command is used to change the password of the currently logged in user.

  14. net user guest 密码: This command is used to change the password of the user named guest.

4. Port process service

  1. tasklist: This command is used to display the list of currently running processes.

  2. tasklist /svc: This command is used to display a list of currently running processes and display the name of the process user.

  3. netstat -ano: This command is used to view the network ports opened by the system and the corresponding process ID.

  4. netstat -ano|findstr 80: This command is used to find the process ID corresponding to port 80.

  5. tasklist | findstr 80: This command is used to find the process corresponding to port 80.

  6. taskkill /f /t /im xx.exe: This command is used to forcefully close the process named xx.exe.

  7. taskkill /F -pid 520: This command is used to forcefully close the process with process ID 520.

  8. net start: This command is used to view the list of currently running services.

  9. net start telnet: This command is used to start the telnet service.

  10. net stop telnet: This command is used to stop the telnet service.

  11. start www.baidu.com: This command is used to open the specified URL (Baidu).

5. Sharing

  1. net use: This command is used to view the current connections established with other computers.

  2. net share: This command is used to view the list of locally opened shared folders.

  3. net share ipc$: This command is used to enable ipc sharing, which is a hidden share used for remote management.

  4. net share ipc$ /del: This command is used to delete ipc shares.

  5. net share c$ /del: This command is used to delete the share of C drive.

  6. net use \\192.168.10.15\ipc$ /u:"" "": This command is used to establish an empty ipc connection with the computer with the IP address 192.168.10.15. For example:net use \\192.168.10.15\ipc$ /u:"" ""

  7. net use \\192.168.10.15 /u:"" "": This command is used to establish an empty connection with the computer with IP address 192.168.10.15. ipc$ can be omitted.

  8. net use \\192.168.10.15 /u:"administrator" "root": This command is used to establish an ipc connection with the computer with IP address 192.168.10.15 as administrator.

  9. net use \\192.168.10.15 /del: This command is used to delete the ipc connection established with the computer with IP address 192.168.10.15.

  10. net use \\192.168.10.15\c$ /u:"administrator" "root": This command is used to establish a shared connection with the C drive on the computer with the IP address 192.168.10.15.

  11. dir \\192.168.10.15\c$: This command is used to view the files on the C drive on the computer with the IP address 192.168.10.15.

  12. dir \\192.168.10.15\c$\user: This command is used to view the files in the user directory of the C drive on the computer with the IP address 192.168.10.15.

  13. dir \\192.168.10.15\c$\user\test.exe: This command is used to view the test.exe file in the user directory of the C drive on the computer with the IP address 192.168.10.15.

  14. net use \\192.168.10.15\c$ /del: This command is used to delete the shared connection to the C drive on the computer with the IP address 192.168.10.15.

  15. net use k: \\192.168.10.15\c$ /u:"administrator" "root": This command is used to map the C drive on the computer with the IP address 192.168.10.15 to the local K drive.

  16. net use k: /del: This command is used to delete the mapping of the local K disk.

6. File operations

  1. echo hello,word > 1.txt: This command writes "hello,word" to a file named 1.txt. If 1.txt does not exist, create the file; if 1.txt already exists, this command will overwrite the original content.

  2. echo hello,word >> 1.txt: This command appends "hello,word" to a file named 1.txt. If 1.txt does not exist, create the file; if 1.txt already exists, append the content to the end of the file.

  3. del: This command is used to delete the specified file. For example:del 1.txt

  4. deltree: This command is used to delete the specified folder and all subfolders and files under it. For example:deltree folder

  5. ren 1.txt 2.txt: This command renames the file named 1.txt to 2.txt.

  6. type 1.txt: This command is used to view the contents of the file named 1.txt.

  7. md: This command is used to create a new folder. For example:md folder

  8. rd: This command is used to delete an empty folder. For example:rd folder

  9. move 1.txt d:/: This command moves the file named 1.txt to the root directory of drive d.

  10. notepad 123.txt: This command is used to open a file named 123.txt and edit it in Notepad.

  11. dir c:\: This command is used to view the files and folders under the C drive.

  12. dir c:\ /A: This command is used to view all files and folders under the C drive, including hidden files.

  13. dir c:\ /S: This command is used to view all files and folders under the C drive and its subfolders.

  14. dir c:\ /B: This command is used to display the file names under the C drive (only the file names, excluding other information).

  15. shutdown -s -t 60 -c "你的电脑被黑了": This command is used to shut down the computer, display a shutdown prompt box with the specified message, and shut down the computer after 60 seconds. It  -s means shutdown, -t 60 means delay shutdown for 60 seconds, and -c "你的电脑被黑了" means the message in the shutdown prompt box.


Summarize

This article introduces many commonly used Dos commands, I hope it can help you.

Follow, like, collect, I hope friends can connect three times with one click!

Guess you like

Origin blog.csdn.net/m0_71369515/article/details/132689320