$ErrorActionPreference = 'Stop' $root = Split-Path -Parent $MyInvocation.MyCommand.Path $webRoot = Join-Path $root 'domain-web' $logDir = Join-Path $webRoot 'runtime\logs' $stdoutLog = Join-Path $logDir 'domain-web.stdout.log' $stderrLog = Join-Path $logDir 'domain-web.stderr.log' New-Item -ItemType Directory -Force -Path $logDir | Out-Null powershell -ExecutionPolicy Bypass -File (Join-Path $root 'stop_domain_web.ps1') | Out-Null $command = "& '" + (Join-Path $root 'start_domain_web.ps1') + "'" Start-Process -FilePath 'powershell' ` -ArgumentList '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', $command ` -WorkingDirectory $webRoot ` -RedirectStandardOutput $stdoutLog ` -RedirectStandardError $stderrLog Write-Output "domain-web 已后台启动(0.0.0.0:3200),日志:$stdoutLog / $stderrLog"