Skip to content
Published at:

Windows

Overview

文档:https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands

命令列表

  • tasklist: Displays a list of currently running processes
  • taskkill: Ends one or more tasks or processes.
  • findstr: Searches for patterns of text in files. 类似grep
  • ipconfig: Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings.
  • netstat
  • chcp: Changes the active console code page
  • sc
  • schtasks
  • start
  • pnputil: Pnputil.exe is a command line utility that you can use to manage the driver store.
  • reg: Performs operations on registry subkey information and values in registry entries.
  • shutdown
  • systeminfo: Displays detailed configuration information about a computer and its operating system, including operating system configuration, security information, product ID, and hardware properties (such as RAM, disk space, and network cards).

tasklist

powershell
# 通过进程号查找程序任务
tasklist /FI "PID eq 12345"

# 通过程序名查找程序任务
tasklist /FI "IMAGENAME eq adb.exe"

taskkill

文档:

Example

powershell
# 通过进程号关闭程序
taskkill /PID 1234

# 同上;强制关闭
taskkill /F /PID 1234

# 通过程序名关闭程序;会关闭多个正在运行的进程
taskkill /F /IMAGENAME adb.exe
  • PID:进程ID
  • F: 强制
  • IMAGENAME:程序名(带后缀)

findstr

ipconfig

netstat

chcp

powershell
chcp            # 查看当前的
chcp 65001      # 换成utf-8代码页
chcp 936        # 换成默认的gbk
chcp 437        # 美国英语

sc

powershell
sc query null   # 查看Null服务状态

schtasks

Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for the IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols).

powershell
netstat -ano | findstr 5037

sc

powershell
start .         # 用文件管理器打开当前目录

pnputil

Pnputil.exe is a command line utility that you can use to manage the driver store. You can use this command to add driver packages, remove driver packages, and list driver packages that are in the store.