@echo off :a set port= echo.&set /p port=输入端口号: cls if not defined port goto :a for /f "tokens=2,4,5" %%a in ('netstat -ano^|find /i ":%port% "') do if not "%%c"=="" (set pid=%%c) else (set pid=%%b) for /f "tokens=1" %%a in ('tasklist /fi "pid eq %pid%"') do set prog=%%a taskkill /f /fi "pid eq %pid%" echo.&echo 按任意键退出 pause exit