# Complete collection of common commands for windows CMD (worth collecting)

OS The column contains this content
24 articles 6 subscription

# preface

cmdyescommandShort for. Command line.

Although with the development of the computer industry,WindowsOperating systems are more and more widely used,DOSFacing the fate of being eliminated, but because it runs safely and stably, and some users are still using it, generally various versions of windows are compatible with it. Users canWindowsRun under systemDOS, Chinese versionWindows XPThe command prompt in further improves the compatibility with operating commands under DOS. Users can directly input Chinese call files at the command prompt.

As a developer, what we use most iswindows, but forcmd, I don't know if you are familiar. Anyway, I haven't been familiar with it. Normal operationlinuxMore, but ignoredcmdFor related commands, some commonly used commands are roughly summarized here as records.

# 1. Common commands

## 1.1 CD command

//Enter D disk
D:
//Enter disk f
F:

cd/?     // Get help using

cdC:\Windows / / jump to other files on the current hard disk

cd/d e:\Software / / jump to other folders on other hard disks. Note that the / D parameter must be added here. Otherwise, you cannot jump.



## 1.2 viewing catalog files

//View the files in the current directory, similar to LS in Linux
dir


If you need to view hidden files or more operations, you can usedir /?Let's check other usage. CMD is very good.

python /?


## 1.3 creating and deleting directories

//Create directory
MD directory name (folder)
//Delete directory
Rd directory name (folder)


## 1.4 view local IP

ipconfig


## 1.5 clear screen

cls


Similar to clear under Linux

## 1.6 copying documents

Copy path \ file name path \ file name: copy a file to another place.


## 1.7 moving files

Move path \ file name path \ file name: move a file (that is, cut it)+Copy) to another place.


## 1.8 deleting files

//This is for deleting files. You cannot delete folders
delfile name


## 1.9 ping

//Used to test whether the network is unblocked
ping ip(host name)


List all tasks and process numbers, and kill the process

taskkill



taskkillIs used to terminate the process. The specific command rules are as follows:

TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]


Description:

This command line tool can be used to end at least one process.

You can end a process based on the process ID or image name.

Parameter list:

/S system specifies the remote system to connect to.
/U [domain\]User specifies which user context should be used


Execute this command:

/P [password]Specify the password for the provided user context. If omitted, prompt for input.
/F specifies the process to be forcibly terminated.
/FI filterSpecify the task to filter in or out the query.
/PID processID specifies the PID of the process to terminate.
/Im image name specifies the image name of the process to terminate. Wildcard'*'Can be used to specify all image names.
/T Tree kill: terminates the specified process and any child processes started by it.
/?  Show help/Usage.


For example:

TASKKILL /S system /F /IM notepad.exe /T
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"


## 1.11 netstat viewing network connection status

Display protocol statistics and currentTCP/IPNetwork connection. This command can view the status of all network links established by the current machine and the corresponding process.

netstat -Help get help for command line usage

netstat -ano  //View the network connection, status and corresponding process ID


Syntax:

netstat [option]


Parameters:

-A or--All: displays the sockets in all connections;
-A < network type > or--< network type >: list the relevant addresses in the connection of the network type;
-C or--Continuous: continuously list the network status;
-C or--Cache: displays the cache information configured by the router;
-E or--Extend: displays other network related information;
-F or--FIB: display FIB;
-G or--Groups: display the group member list of multi broadcast function group;
-I or--Interfaces: displays the network interface information form;
-L or--Listening: displays the socket of the server under monitoring;
-M or--Masquerade: display the camouflaged network connection;
-N or--Numeric: directly use the IP address instead of the domain name server;
-N or--Netlink or--Symbolic: displays the symbolic connection name of the network hardware peripheral;
-O or--Timers: display the timer;
-P or--Programs: displays the program ID and program name of the socket being used;
-R or--Route: displays the routing table;
-S or--Statistics: displays the statistical table of network work information;
-T or--TCP: displays the connection status of TCP transmission protocol;
-U or--UDP: displays the connection status of UDP transmission protocol;
-V or--Verbose: display the instruction execution process;
-V or--Version: displays version information;
-W or--Raw: displays the connection status of raw transmission protocol;
-X or--UNIX: effect and specification of this parameter"-A unix"The parameters are the same;
--IP or--INET: effect and assignment of this parameter"-A inet"The parameters are the same.


## 1.12 find

find /？ Get help using

netstat -ano|find ".8"   //Use the pipe symbol for fuzzy query


## 1.13 tracert

tracertAlso known asWindowsRoute tracing utility, used at the command prompt (CMD)tracertThe command can be used to determine the path selected when IP packets access the destination.

tracert /?  Get help using


# 2. View the command under CMD

1. Use the help command to view all DOS commands

After using this command, we can see all DOS commands, and there is a Chinese explanation later. It's not great, so we can find the command we want to use according to our needs.

2. After finding the command, use the command + /? To view other properties under this command

Command-help    //The firstoneTwo forms of help

Command/?       //The firsttwoTwo forms of help


Note: these characters can only be in English

# 3. Auxiliary symbols or commands

## 3.1 ‘|’

"|" in the CMD command |, the output of the previous one represents the input of the next one

Find the network connection and process number of a specific IP:netstat -ano|find "192.168.1.10"

## 3.2 redirect output symbol > >

Transfer the contents originally output to the command window to a file, such asjstack 12912 >d:/s.txtPrint thread to specified file

cmd >Redirect the output and overwrite the source file.

for example

 echohello >c:\1.txt  //one.Txt file content is emptied first, and then written to hello.


CMD > > redirect output is appended to the end of the file

For example:

 echohello >>c:\1.txt  //At 1.Add hello at the end of TXT file


## 3.3 redirect input symbol <<<

cmd < file


Make CMD command read from file

cmd << text


The input is read from the command line until the end of the same line as text.

Unless the input is enclosed in quotation marks, this mode modifies the inputshellVariable substitution.

If < < -, the tab at the beginning of the next input line will be ignored, and the end line can also be a pile of tabs plus the same content as text. You can refer to the following examples.

cmd <<< word


Provide word (not the word file) and the following newline as input to CMD.

cmd <> file


Redirect the file file to the input in read-write mode, and the file file will not be damaged. It makes sense only if the application takes advantage of this feature.

cmd >|file


The function is the same as >, but the file file will be overwritten even when noclobber is set. Note that | is used instead of what is said in some books!, At present, it is still used in CSH only! Realize this function.

## 3.4 terminate the running command Ctrl + C

Sometimes a command keeps printing out results (such asping 192.168.1.10 -t）, we want to terminate the execution of this command, just pressctrl+cJust.

## 3.5 clear CMD window content command CLS

Sometimes there are too many CMD contents and it takes too much time to scroll. You need to clear the screen content and directly enter CLS

CMD command, press the up arrow of the keyboard to copy the previous command directly

## 3.6 common tools

Process Explorer, query the process details, such as Java process startup parameters, running environment, thread information, network connection information, which DLLs are used and what handles are opened. Including registry, socket, file, etc.

Download addresshttps://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer

# 4. Attach some shortcut keys under windows

win+E open the file manager

win+D display desktop

win+L lock computer

alt+F4 close the current program

ctrl+shift+ESC opens the task manager (or CTRL)+alt+delete）

ctrl+F search in a text or web page, which is quite practical (generally press ESC to exit)

ctrl+A select all text


Insert expression
Can also inputone thousandCharacters
Relevant recommendations More similar content
©️ 2020 CSDN Skin theme: Whale Designer: meimeiellie
Paid inelement
Payment with balance
Click retrieve
Code scanning payment
Wallet balance 0

Deduction Description:

1. The balance is the virtual currency of wallet recharge, and the payment amount is deducted according to the ratio of 1:1.
2. The balance cannot be purchased and downloaded directly. You can buy VIP, c-coin package, paid column and courses.

Balance recharge
mbapedia4.com