mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
13 lines
314 B
PowerShell
13 lines
314 B
PowerShell
$defaultPort = 7456
|
|
|
|
$userPort = Read-Host "enter port [$defaultPort]:"
|
|
|
|
if ($userPort -eq "")
|
|
{
|
|
$userPort = $defaultPort
|
|
}
|
|
|
|
Write-Host "free port: $userPort"
|
|
|
|
|
|
Get-NetTCPConnection -State Listen | Where-Object { $_.LocalPort -eq $userPort } | ForEach-Object { Get-Process -ID $_.OwningProcess } | Stop-Process |