Skip to content

Instantly share code, notes, and snippets.

@qlong8807
Created January 30, 2019 09:31
Show Gist options
  • Save qlong8807/01ec8531150d71c97d3d1a50bbf4e0e0 to your computer and use it in GitHub Desktop.
Save qlong8807/01ec8531150d71c97d3d1a50bbf4e0e0 to your computer and use it in GitHub Desktop.
端口杀进程
@echo off
setlocal enabledelayedexpansion
set port=30056
for /f "tokens=1-5" %%a in ('netstat -ano ^| find ":%port%"') do (
if "%%e%" == "" (
set pid=%%d
) else (
set pid=%%e
)
echo !pid!
taskkill /f /t /pid !pid!
)
pause//可有可无
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment