param([switch]$Build) $ErrorActionPreference = 'Stop' Push-Location $PSScriptRoot try { if ($Build) { flutter build windows --release if ($LASTEXITCODE -ne 0) { throw 'Flutter Windows 构建失败' } } $exe = Join-Path $PSScriptRoot 'build/windows/x64/runner/Release/ads_manager.exe' if (-not (Test-Path -LiteralPath $exe)) { throw '请先运行 .\start-windows.ps1 -Build' } Start-Process -FilePath $exe -WorkingDirectory $PSScriptRoot } finally { Pop-Location }