@echo off setlocal ENABLEDELAYEDEXPANSION REM --- Se place dans le dossier du .bat --- cd /d "%~dp0" echo --- Mise en prod Ratio_Restauration --- REM === 1) MISE À JOUR DE VERSION === REM Fichier de version pour la restauration set VERSION_FILE=..\Excel\prod\Ratio_Restauration_VERSION.txt echo Mise à jour de version... python "maj_version.py" "%VERSION_FILE%" REM Si tu utilises 'py' au lieu de 'python', commente la ligne ci-dessus et décommente celle-ci : REM py "maj_version.py" "%VERSION_FILE%" if errorlevel 1 ( echo ERREUR lors de la mise à jour de version. endlocal exit /b 1 ) REM === 2) CHEMINS DES FICHIERS EXCEL === set SRC=..\Excel\dev\Ratio_Restauration_dev.xlsm set DST_DIR=..\Excel\prod REM Dossier commun de sauvegardes (Cuisine + Restauration) set BACKUP_DIR=..\Excel\backup if not exist "%BACKUP_DIR%" ( mkdir "%BACKUP_DIR%" ) REM Vérifications if not exist "%SRC%" ( echo ERREUR : fichier source introuvable : echo %SRC% endlocal exit /b 1 ) if not exist "%DST_DIR%" ( echo ERREUR : dossier de destination introuvable : echo %DST_DIR% endlocal exit /b 1 ) REM === 3) GÉNÉRATION DE LA DATE AU FORMAT AAAAMMJJ === for /f %%a in ('powershell -NoProfile -Command "Get-Date -Format yyyyMMdd"') do set TODAY=%%a set BACKUP=%BACKUP_DIR%\Ratio_Restauration_%TODAY%.xlsm REM === 4) COPIE VERS PROD === echo Copie vers la version de production... copy /Y "%SRC%" "%DST_DIR%\Ratio_Restauration.xlsm" REM === 5) SAUVEGARDE DATÉE === echo Création de la sauvegarde datée... copy /Y "%SRC%" "%BACKUP%" echo --- Mise en prod terminee --- endlocal exit /b 0