mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
添加清理端口脚本
This commit is contained in:
13
script/freePort.ps1
Normal file
13
script/freePort.ps1
Normal file
@@ -0,0 +1,13 @@
|
||||
$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
|
||||
Reference in New Issue
Block a user