@echo off
setlocal enabledelayedexpansion
for /f "delims= tokens=1"% %i in ('netstat -aon ^| findstr "8080"') do (
set a=%%i
goto js
):js taskkill /f /pid "! A: ~ 71, 5!" pause>nulCopy the code
Copy the code directly to a new notepad file named kill-8080.bat. Finally, when port 8080 is occupied, double-click to open the file to kill the port 8080 process.