Windows 端口占用命令一键解决
2025-04-06
Windows
for /f "tokens=5" %a in ('netstat -ano ^| findstr :443') do taskkill /PID %a /Fbat命令
@echo off
setlocal enabledelayedexpansion
:: Prompt user for port number
set /p port=Enter the port number:
:: Use netstat to find processes using the specified port and kill them
for /f "tokens=5" %%a in ('netstat -ano ^| findstr :%port%') do (
echo Killing process with PID %%a using port %port%
taskkill /PID %%a /F
)
echo Done.
pause
发表评论: