Files
register/stop-localhost.ps1
T
Admin Nasledstvo ac168868ee Initial import
2026-05-01 20:52:04 +03:00

13 lines
491 B
PowerShell

$ports = 8081, 8082, 8083, 8084
foreach ($port in $ports) {
$connections = Get-NetTCPConnection -State Listen -LocalPort $port -ErrorAction SilentlyContinue
foreach ($connection in $connections) {
$process = Get-Process -Id $connection.OwningProcess -ErrorAction SilentlyContinue
if ($process -and $process.Path -eq 'C:\xampp\php\php.exe') {
Stop-Process -Id $process.Id -Force
Write-Host "Stopped PHP server on port $port"
}
}
}