@echo off setlocal cd /d "%~dp0" if not exist "customs-declaration-sync-agent.py" goto missing_agent if not exist "customs-declaration-sync-agent.json" goto missing_config py -3.14 --version >nul 2>nul if not errorlevel 1 goto run_with_py314 py -3.13 --version >nul 2>nul if not errorlevel 1 goto run_with_py313 py -3.12 --version >nul 2>nul if not errorlevel 1 goto run_with_py312 py -3.11 --version >nul 2>nul if not errorlevel 1 goto run_with_py311 where python >nul 2>nul if not errorlevel 1 goto run_with_python echo A supported stable Python was not found. echo Install 64-bit Python 3.12. Do not use a Python 3.15 alpha or beta release. goto failed :run_with_py314 py -3.14 "customs-declaration-sync-agent.py" --config "customs-declaration-sync-agent.json" --documents-only set "EXIT_CODE=%ERRORLEVEL%" goto report :run_with_py313 py -3.13 "customs-declaration-sync-agent.py" --config "customs-declaration-sync-agent.json" --documents-only set "EXIT_CODE=%ERRORLEVEL%" goto report :run_with_py312 py -3.12 "customs-declaration-sync-agent.py" --config "customs-declaration-sync-agent.json" --documents-only set "EXIT_CODE=%ERRORLEVEL%" goto report :run_with_py311 py -3.11 "customs-declaration-sync-agent.py" --config "customs-declaration-sync-agent.json" --documents-only set "EXIT_CODE=%ERRORLEVEL%" goto report :run_with_python python -c "import sys; raise SystemExit(0 if sys.version_info[0] == 3 and sys.version_info[1] in (11, 12, 13, 14) else 1)" >nul 2>nul if errorlevel 1 goto unsupported_python python "customs-declaration-sync-agent.py" --config "customs-declaration-sync-agent.json" --documents-only set "EXIT_CODE=%ERRORLEVEL%" goto report :unsupported_python echo The default Python is an unsupported Python 3.15 pre-release. echo Install 64-bit Python 3.12, then run this launcher again. goto failed :missing_agent echo Missing customs-declaration-sync-agent.py in this folder. goto failed :missing_config echo Missing customs-declaration-sync-agent.json in this folder. echo Rename the downloaded example config and complete its settings. goto failed :report echo. if "%EXIT_CODE%"=="0" echo Collection completed. if not "%EXIT_CODE%"=="0" echo Collection did not finish. Check customs-declaration-sync-agent.log and single-window-failures. pause exit /b %EXIT_CODE% :failed echo. pause exit /b 1