# Kill hung diagnostic shells + restart desktop cleanly $ErrorActionPreference = 'SilentlyContinue' $killPids = @(3816, 22404, 18992, 10712, 16424) foreach ($p in $killPids) { Stop-Process -Id $p -Force -ErrorAction SilentlyContinue } Get-Process electron -ErrorAction SilentlyContinue | Stop-Process -Force Get-Process -Name 'node' -ErrorAction SilentlyContinue | Where-Object { $_.Path -like '*douyinWEB*' -or (Get-CimInstance Win32_Process -Filter "ProcessId=$($_.Id)").CommandLine -match 'douyinWEB\\desktop|vite|electron' } | Stop-Process -Force -ErrorAction SilentlyContinue # Kill listeners on key ports foreach ($port in 8014, 5173) { netstat -ano | Select-String ":$port\s+.*LISTENING\s+(\d+)" | ForEach-Object { if ($_.Matches.Groups.Count -gt 1) { $pidToKill = $_.Matches.Groups[1].Value if ($pidToKill) { taskkill /F /PID $pidToKill 2>$null } } } } # Also kill python uvicorn for this project Get-CimInstance Win32_Process -Filter "Name='python.exe'" | Where-Object { $_.CommandLine -match 'uvicorn|app\.main' } | ForEach-Object { taskkill /F /PID $_.ProcessId 2>$null } Start-Sleep -Seconds 2 Set-Location 'c:\Users\admin\Desktop\douyinWEB\desktop' npm run build:electron npm run electron:dev