??# --- gov_profile_launcher_v1.9.2.ps1 (no-preflight delegator) --- try { [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding } catch {} $here = $PSScriptRoot; if (-not $here) { $here = Split-Path -Parent $MyInvocation.MyCommand.Path } $root = Split-Path -Parent $here function Get-Version([string]$name){ $m = [regex]::Match($name, '_v([0-9]+(?:\.[0-9]+)*)\.ps1$') if ($m.Success) { try { return [version]$m.Groups[1].Value } catch { return [version]'0.0' } } return [version]'0.0' } $scriptsDir = Join-Path $root 'scripts' $cands = Get-ChildItem -LiteralPath $scriptsDir -Filter 'gov_profile_launcher_v*.ps1' -File -EA SilentlyContinue | Where-Object { $_.Name -ne 'gov_profile_launcher_v1.9.ps1' } if (-not $cands) { Write-Host '[BLOCK] aucun launcher versionne trouve (hors v1.9).'; exit 2 } $best = $cands | Sort-Object @{Expression={ Get-Version $_.Name };Descending=$true}, @{Expression={$_.LastWriteTime};Descending=$true} | Select-Object -First 1 Write-Host ("Delegating to: {0}" -f $best.FullName) & powershell -NoProfile -ExecutionPolicy Bypass -File $best.FullName @args exit $LASTEXITCODE