13 lines
491 B
PowerShell
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"
|
|
}
|
|
}
|
|
}
|