@echo off setlocal set "ROOT=\\DS-918\chatgpt\ChatGPT-Gouvernance-Projets\_registry" set "PS=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" set "GUARD=%ROOT%\scripts\kb_dev_guard_v1.0.ps1" REM -- Fonction PowerShell inline: cr?e PSDrive GOV: -> ROOT pour la session -- set "MK_GOV=New-PSDrive -Name GOV -PSProvider FileSystem -Root '%ROOT%' -ErrorAction SilentlyContinue | Out-Null" if "%~1"=="" goto :open set "SCRIPT=%~1" shift "%PS%" -NoProfile -ExecutionPolicy Bypass -NoLogo -Command ". '%GUARD%' 2>$null; %MK_GOV%; try { & '%SCRIPT%' %*; if($LASTEXITCODE){exit $LASTEXITCODE}else{exit 0} } catch { $_ | Out-String | Out-File -FilePath (Join-Path (Join-Path '%ROOT%' 'updates\inbox\kb') ('SLOF_'+[IO.Path]::GetFileNameWithoutExtension('%SCRIPT%')+'_'+(Get-Date -Format 'yyyyMMdd_HHmmss')+'.err.txt')) -Encoding UTF8; exit 1 }" exit /b %ERRORLEVEL% :open "%PS%" -NoProfile -ExecutionPolicy Bypass -NoLogo -NoExit -Command ". '%GUARD%' 2>$null; %MK_GOV%; Write-Host '[GOV SHELL READY - PSDrive GOV: mounted]' -ForegroundColor Green"