判断端口号被某些进程占用
netstat -ano | findstr :1080
kill 掉这个进程
taskkill /PID 1676 /F
查看一个进程的详细情况
wmic process where "ProcessId=18092" get Caption,Commandline,ProcessId
发现一个占用端口好的进程,并kill它的bat脚本
@echo off
setlocal
rem Find the PID of the process using port 1080
for /f "tokens=5" %%a in ('netstat -ano ^| findstr :1080') do (
echo PID found: %%a
rem Kill the process
taskkill /PID %%a /F
)
endlocal
pause