$ErrorActionPreference = "Stop" $envScript = "D:\ae\proj\Renderive\render_3D\env.ps1" $targetExe = "D:\ae\proj\Renderive\cmake-build-vs2022_debug\web_server\Renderive_Web_Server.exe" $workingDir = Split-Path -Parent $targetExe if (-not (Test-Path -LiteralPath $envScript)) { throw "Environment script not found: $envScript" } if (-not (Test-Path -LiteralPath $targetExe)) { throw "Target executable not found: $targetExe" } Write-Host "" Write-Host "Loading environment:" Write-Host " $envScript" # Dot-source env.ps1 so its environment changes are applied to this PowerShell process. . $envScript # Make sure DLLs next to the executable can also be resolved. if (($env:Path -split ';') -notcontains $workingDir) { $env:Path = "$workingDir;$env:Path" } Write-Host "" Write-Host "Working directory:" Write-Host " $workingDir" Write-Host "" Write-Host "Starting:" Write-Host " $targetExe" Write-Host "" Push-Location $workingDir try { # Forward any arguments passed to this script to Renderive_Web_Server.exe. & $targetExe @args $exitCode = $LASTEXITCODE } finally { Pop-Location } Write-Host "" Write-Host "Renderive_Web_Server exit code: $exitCode" exit $exitCode