@echo off setlocal enabledelayedexpansion REM Set file paths set CONFIG_FILE=%~dp0config.json set REQUIREMENTS=requirements.txt set ENV_NAME=WINenv set ENV_PATH=%~dp0%ENV_NAME% REM Extract config.json fields using PowerShell for /f "delims=" %%i in ('powershell -NoProfile -Command ^ "Get-Content '%CONFIG_FILE%' | ConvertFrom-Json | Select-Object -ExpandProperty python_version"') do set PYTHON_VERSION=%%i for /f "delims=" %%i in ('powershell -NoProfile -Command ^ "Get-Content '%CONFIG_FILE%' | ConvertFrom-Json | Select-Object -ExpandProperty architecture"') do set ARCHITECTURE=%%i REM Construct python executable path set PYTHON_EXEC=C:\Logiciels\Python\%ARCHITECTURE%\%PYTHON_VERSION%\python.exe if not exist "%PYTHON_EXEC%" ( echo [ERROR] Python introuvable à: %PYTHON_EXEC% echo Veuillez vérifier votre config.json ou le dossier d'installation. exit /b 1 ) REM Show config info echo [INFO] Configuration : echo Python: %PYTHON_EXEC% echo Env: %ENV_NAME% REM Check if virtual environment exists if not exist "%ENV_PATH%\Scripts\activate.bat" ( echo [INFO] Environnement virtuel introuvable, création... "%PYTHON_EXEC%" -m venv "%ENV_NAME%" call "%ENV_PATH%\Scripts\activate.bat" echo [INFO] Installation des dépendances... pip install --upgrade pip pip install -r "%REQUIREMENTS%" ) else ( echo [INFO] Environnement virtuel trouvé. ) REM Activate and launch VS Code call "%ENV_PATH%\Scripts\activate.bat" echo [INFO] Lancement de VS Code... start code "%~dp0" exit /b 0