39246-vm/kill_port.ps1
abbashkyt-creator 7d8ce0e322 V0.1
2026-03-14 04:02:22 +03:00

12 lines
367 B
PowerShell

$lines = netstat -ano | Select-String ":8000 "
foreach ($line in $lines) {
$parts = $line.ToString().Trim() -split '\s+'
$pid_val = $parts[-1]
if ($pid_val -match '^\d+$') {
Stop-Process -Id ([int]$pid_val) -Force -ErrorAction SilentlyContinue
Write-Host "Killed PID $pid_val"
}
}
Start-Sleep -Seconds 2
Write-Host "Port 8000 cleared"