This commit is contained in:
Your Name
2026-04-16 13:05:07 +08:00
commit 32efff1670
99 changed files with 9974 additions and 0 deletions

25
stop_domain_web.ps1 Normal file
View File

@@ -0,0 +1,25 @@
$ErrorActionPreference = 'Stop'
$webPort = if ($env:WEB_PORT) { $env:WEB_PORT } else { '3200' }
$processIds = @()
$targets = Get-CimInstance Win32_Process | Where-Object {
$_.CommandLine -like "*vite*--host 0.0.0.0 --port $webPort*" -or
$_.CommandLine -like "*npm*run dev*--port $webPort*"
}
$processIds += $targets.ProcessId
$listeners = Get-NetTCPConnection -LocalPort ([int]$webPort) -State Listen -ErrorAction SilentlyContinue
if ($listeners) {
$processIds += $listeners.OwningProcess
}
$processIds = $processIds | Where-Object { $_ } | Select-Object -Unique
if (-not $processIds) {
Write-Output 'domain-web 当前没有运行中的进程'
exit 0
}
foreach ($processId in $processIds) {
Stop-Process -Id $processId -Force -ErrorAction SilentlyContinue
}
Write-Output ("domain-web 已停止,进程数: " + (($processIds | Measure-Object).Count))