Summary of common Windows CMD commands (worthy of collection)

1. Tips:

  • Enter help, view help
  • Tab 键, autocomplete
  • 上/下方向键, view historical commands

2. Common commands

2.1 cd command

D:      		 //进入D盘
cd \   		 	//跳转到硬盘的根目录
cd ..			//回到上级目录
cd C:\WINDOWS  //`跳转到当前硬盘的其他文件`
cd /d  d:\tmp   //`跳转到其他硬盘的其他文件夹`,注意此处必须加`/d参数`。否则无法跳转。
cd 				//显示当前目录位置
cd d:			//显示指定磁盘的当前目录位置

2.2 Service Management

net start		//显示当前正在运行的服务
net start 服务名	//启动指定服务
net stop 服务名	//停止指定服务

2.3 Clear the screen

cls

2.4 Display directory structure

tree  d:\k8s

image-20221021141443048

2.5 Display the list of files in the directory

dir  //查看当前目录下的文件,类似于linux下的 ls -al

2.6 Create and delete directories

md test		//新建文件夹
rd test		//删除文件夹

2.7 File copy, move, delete

move d:\test.txt  d:\k8s //把一个文件拷贝到另一个地方

move 路径\文件名 路径\文件名   //把一个文件移动到另一个地方。

del 文件名 			 //只能删除文件,不能删文件夹

2.8 Comparing two text documents for differences

fc [path\to\file1] [path\to\file2]

image-20221021154149527

2.9 Network Operations

ipconfig			//查看本机IP
ping ip/域名			//延迟和丢包率
ping ip/域名 -n 5		//Ping 测试 5 次:
ping ip/域名 -t		//Ping 不停测试
ipconfig /flushdns	  //清除本地 DNS 缓存(这个很实用)
arp -d 				//清除arp表
tracert ip/域名		//路由追踪 

Use ping ip/domain name -t //Ping non-stop test to end sending packets Ctrl+C press the shortcut key

Ctrl+C is to forcibly interrupt the execution of the program. There is also an interrupt command
in the process of killing the program . There is a difference between them.Ctrl+Z

Ctrl+Z is to interrupt and suspend the task, the process still exists, and the task has not ended

2.10 Process Management

tasklist		//显示当前正在运行的进程
start 程序名		//运行程序或命令
taskkill /im notepad.exe	//结束进程,按名称
taskkill /pid 1234 		//结束进程,按 PID:(1234的pid进程)

2.11 netstat View network connection status

netstat [参数] 	//常用 netstat –ano|findstr 8080 查询指定端口进程的pid 
				 //netstat -ano|find "80"   //使用管道符,进行模糊查询
				 //`findstr支持正则表达式、find无正则。推荐findstr`

Parameters :

-a或--all:显示所有连线中的Socket;
-A<网络类型>或--<网络类型>:列出该网络类型连线中的相关地址;
-c或--continuous:持续列出网络状态;
-C或--cache:显示路由器配置的快取信息;
-e或--extend:显示网络其他相关信息;
-F或--fib:显示FIB;
-g或--groups:显示多重广播功能群组组员名单;
-h或--help:在线帮助;
-i或--interfaces:显示网络界面信息表单;
-l或--listening:显示监控中的服务器的Socket;
-M或--masquerade:显示伪装的网络连线;
-n或--numeric:直接使用ip地址,而不通过域名服务器;
-N或--netlink或--symbolic:显示网络硬件外围设备的符号连接名称;
-o或--timers:显示计时器;
-p或--programs:显示正在使用Socket的程序识别码和程序名称;
-r或--route:显示Routing Table;
-s或--statistice:显示网络工作信息统计表;
-t或--tcp:显示TCP传输协议的连线状况;
-u或--udp:显示UDP传输协议的连线状况;
-v或--verbose:显示指令执行过程;
-V或--version:显示版本信息;
-w或--raw:显示RAW传输协议的连线状况;
-x或--unix:此参数的效果和指定"-A unix"参数相同;
--ip或--inet:此参数的效果和指定"-A inet"参数相同。

2.12 Shutdown, restart, logout, sleep, timer

  • shutdown:shutdown /s
  • restart:shutdown /r
  • Logout:shutdown /l
  • sleep:shutdown /h /f
  • Cancel shutdown:shutdown /a
  • Scheduled shutdown: shutdown /s /t 3600(shutdown after 3600 seconds)

3. View the commands under cmd

1. Use the help command to view all dos commands

After using this command, we can see all dos commands, and there are Chinese explanations behind them.

image-20221021145157180

2. After finding the command, use command + /? to view other attributes under the command

命令 -help    //第1种形式的使用帮助
命令  /?       //第2种形式的使用帮助

4. Shortcut keys under Windows

  • Open the file manager: win+E
  • Show and hide the desktop: win+D
  • Lock computer: win+L
  • Close the current program: alt+F4
  • Open task manager: ctrl+shift+Esc or ctrl+alt+delete
  • Switch between open apps: Alt + Tab
  • Window size and position: Win + up, down, left, and right keys
  • Minimize all windows: Win+M
  • Windows settings: Win + I
  • Create a new file: Ctrl+N
  • Create a new folder: Ctrl+Shift+N
  • Undo: Ctrl+Z
  • Needless to say, Ctrl+C and Ctrl+V
  • User start, Win+r input cmd, Enter
  • Administrator start, Win+r input cmd, Ctrl+Shift+Enter

5. Other commands

5.1 Disk scan (under the administrator)

chkdsk

5.2 Automatic disk scan and repair problems (under the administrator)

sfc /scannow

5.3 Start the calculator

calc

5.4 Open Notepad

notepad

5.5 Open the registry

regedit

5.6 IP address detector

nslookup

5.7 TCP/IP protocol or Winsock corruption problem

netsh interface ipv4 resetnetsh interface ipv6 resetnetsh winsock reset

5.8 Routing query

route print

insert image description here

5.9 windows dos interface escalation privilege command

runas /user:administrator cmd

5.10 Check DirectX information

dxdiag

Reference : link link link

Guess you like

Origin blog.csdn.net/crayon0/article/details/127447433