问题
开发中进程会出现端口被占用导致进程无法启动的问题。今天记录一下自己是根据端口号查看占用他的进程的。
解决
很简单,打开命令行串口(快捷键win + r
,输入cmd
回车),两步搞定
1. 查端口
netstat -ano | grep <port> # 查看端口号,及附属的进程
<port> 是要查询的端口号
输出:
Proto Local Address Foreign Address State PID
TCP 127.0.0.1:13531 0.0.0.0:0 LISTENING 1212
2. 查进程
tasklist | grep <pid> # 根据进程号查看对应的启动程序
<pid> 是第一步中查询出来的进程号
输出:
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
CNPrintClient.exe 1212 Console 2 20,680 K