DOS command details

0DOS command DOS command, a computer term, refers to the command of DOS operating system, which is a disk oriented opera...
1.1 internal commands
1.2 external commands
1.3 batch commands
2.1cd change current path
2.2md create folder
2.3dir displays the contents of the path
2.4tree displays all directory paths on the specified drive and all file names under these directories
2.5del delete file
2.6rd delete empty directory
2.7 echo create file
2.8 type display file content
2.9 copy files to target location
2.10xcopy copy directories and files
2.11move move files
2.12ren rename
2.13 attrib display or change file attributes
2.14 fsutil generates an empty file
2.15 Assoc modify relevance
2.16 shutdown setting timing
2.17cls screen clearing
2.18 date display date time display time
2.19 Ping test
2.20ipconfig displays ip information
2.21nslookup domain name resolution
2.22tasklist displays the current process on the local or remote machine
2.23net config displays the running services

0DOS command

DOS command, a computer term, refers to the command of DOS operating system, which is a disk oriented operation command.

1DOS command classification

DOS commands provided for users can be divided into three categories:

1.1 internal commands

It is a part of the resident memory in DOS command. It is loaded into memory by the system files on the disk when the system is cold and hot started. When using, the user only calls a program segment in the system area in memory to execute. For example, DIR, TYPE, COPY and other commands are internal commands.

1.2 external commands

It exists on disk in the form of executable program file (usually suffix. EXE or. COM). This means that the command file must be recorded on the disk or the floppy disk inserted into the drive, otherwise DOS cannot find the command. For example, FORMAT.COM, DISKCOPY.COM, etc.

1.3 batch commands

In the process of using disk commands, sometimes several DOS commands need to be used continuously, sometimes several DOS commands need to be used repeatedly, and sometimes some DOS commands need to be used selectively. In order to meet these requirements, DOS provides some special files - files with the suffix BAT. This file allows users to organize keyboard command language programs, which can be established at one time and executed many times. This BAT file can be created by word processing software. The most typical example is a batch command file named AUTOEXEC.BAT on the DOS system disk. When the system starts cold and hot, the machine will automatically execute the DOS commands on the file.

2 common commands

2.1cd change current path

cd.. #Return to the previous level cd\ #Return to the root directory cd c:\Windows #Enter target path d: #Do not enter cd, just enter the drive letter and colon to enter disk D.

2.2md create folder

cd\ #Return to the root directory d: #Enter disk D md test #Create a folder named test in the current directory md test2\test3 #Create test2 in the current directory and test3 in it

2.3dir displays the contents of the path

cd\ #Return to the root directory dir #Display the first level content in the directory of disk C dir c:\Windows #Displays the first level content under the target directory dir c:\Windows/p #Pause after displaying a full page, and press any key to continue browsing dir c:\Windows | more #Pagination display using pipe characters dir c:\Windows/w #Only the file name is displayed, and no other properties are displayed #/w/p can be used at the same time

2.4tree displays all directory paths on the specified drive and all file names under these directories

cd\ #Return to the root directory tree c: #Display all directories in a tree form without writing the drive letter tree c: /f #All files are displayed in a tree form without writing the drive letter. There should be a space between the drive letter and / or

2.5del delete file

cd\ #Return to the root directory d: #Enter disk D del 1.txt #Delete files in the target directory del 1.txt/p #Prompt to confirm deletion del *.* #If you use wildcards to delete in batch, you will be automatically prompted to confirm the deletion del *.* /q #Quiet mode, no prompt, confirm deletion del *.* /s #Delete all files in the current path, including files in subfolders. Do not delete folder #/q /s can be used together

2.6rd delete empty directory

cd\ #Return to the root directory rd c:\test2\test3 #Delete the test3 empty folder under the path rd c:\test2 #Delete the test2 empty folder under the path

2.7 echo create file

cd\ #Return to the root directory d: #Enter disk D echo 6666>1.txt #If there is no such file, it will be created and written according to the content. If there is, it will be overwritten according to the content echo 7777>>1.txt #If there is no such file, it will be created and written according to the content. If there is, it will be appended according to the content

For other detailed usage of echo, please refer to< Detailed explanation of ECHO command in DOS>

2.8 type display file content

cd\ #Return to the root directory type d:\1.txt #Print out the contents of the file d: #Enter disk D type 1.txt #You may not enter the full path type 1.txt | more #Enter the pipe symbol and display it in pages

2.9 copy files to target location

cd\ #Return to the root directory copy c:\test\1.txt d:\test #Copy the C disk file to the D disk directory copy c:\test\*.* d:\test #Copy using wildcards copy .\1.txt ..\test\ #. \ current folder,.. \ indicates the parent folder

Using copy command to create multiline file

cd\ #Return to the root directory d: #Enter disk D copy con qingshu.txt #con represents the screen. Copy the screen content to a file and wrap lines multiple times Dear I love you #After editing, press ctrl+Z to end the command

2.10xcopy copy directories and files

2.11move move files

cd\ #Return to the root directory move .\1.txt ..\test\ #. \ current folder,.. \ indicates the parent folder

2.12ren rename

cd\ #Return to the root directory ren c:\test\1.txt 6.txt #Rename 1.txt to 6.txt ren c:\test\*.txt *.jpg #Modify the suffix of all txt files in the target path to jpg #Can handle file and folder names

2.13 attrib display or change file attributes

cd\ #Return to the root directory d: #Enter disk D md test #Create a folder named test in the current directory attrib +h test #Set the test attribute as hidden, and use the "-" sign to clear the hidden attribute attrib +s +h +a test #Set the test attribute to a protected system level file, a archive, r read-only #Can act on files and folders

2.14 fsutil generates an empty file

#Need to run as Administrator cd\ d: #Enter disk D fsutil file createnew d:\1.ini 1024000 #Generate an empty file of 10k in the directory

2.15 Assoc modify relevance

#Need to run as Administrator cd\ d: #Enter disk D assoc .txt=exefile #Open txt text as an executable assoc .txt=txtfile #recovery

2.16 shutdown setting timing

cd\ d: #Enter disk D shutdown -s -t 100 #Automatically shut down after 100 seconds, s means shut down, t means set time seconds shutdown -s -f -t 100 #Force automatic shutdown after 100 seconds, f means forced shutdown. shutdown -s -f -t 100 -c"Turn it off, you" #Set to force automatic shutdown after 100 seconds, with string. shutdown -a #Cancel all timing shutdown -r -t 100 #Automatically restart after 100 seconds, r means restart, t means set time seconds shutdown -l #Direct shutdown

2.17cls screen clearing

2.18 date display date time display time

2.19 Ping test

ping target IP address # Test the network connectivity. You can communicate successfully if you go back and forth! ping -t target IP address # Keep ping and press ctr+C to end ping -n Digital target IP address # Modify the number of ping packets ping -l Digital target IP address # Modify the size of the ping package in B #ping is the meaning of testing. It is called only when there is a return. If ping fails, the other party may not be online or the other party has a firewall on!

2.20ipconfig displays ip information

ipconfig # View basic IP address information ipconfig /all # View IP address details;

2.21nslookup domain name resolution

nslookup www.jd.com

2.22tasklist displays the current process on the local or remote machine

2.23net config displays the running services

cd\ #Return to the root directory net config #Shows that the Server and VM workstations are running net config workstation #Displays information such as computer name and user name
3 open the help file for the command

Add /? After the queried command to query the usage of relevant commands.

cd\ #Return to the root directory net config/? #Query net config help document
reference

During the initial learning of network security, temporarily understand the DOS command system and common commands to form a certain framework system. If necessary, continue to strengthen it in subsequent learning.
1. DOS common commands
2. DOS command Encyclopedia

30 November 2021, 22:53 | Views: 7536

Add new comment

For adding a comment, please log in
or create account

0 comments