@echo off set "PATH=C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;%PATH%" if exist "C:\Python315\python.exe" set "PATH=%PATH%;C:\Python315" if exist "C:\Python314\python.exe" set "PATH=%PATH%;C:\Python314" if exist "C:\Python313\python.exe" set "PATH=%PATH%;C:\Python313" if exist "C:\Python312\python.exe" set "PATH=%PATH%;C:\Python312" if exist "C:\Python311\python.exe" set "PATH=%PATH%;C:\Python311" if exist "C:\Python310\python.exe" set "PATH=%PATH%;C:\Python310" if exist "C:\Program Files\Python315\python.exe" set "PATH=%PATH%;C:\Program Files\Python315" if exist "C:\Program Files\Python314\python.exe" set "PATH=%PATH%;C:\Program Files\Python314" if exist "C:\Program Files\Python313\python.exe" set "PATH=%PATH%;C:\Program Files\Python313" if exist "C:\Program Files\Python312\python.exe" set "PATH=%PATH%;C:\Program Files\Python312" if exist "C:\Program Files\Python311\python.exe" set "PATH=%PATH%;C:\Program Files\Python311" if exist "C:\Program Files\Python310\python.exe" set "PATH=%PATH%;C:\Program Files\Python310" cd /d C:\ echo [python-installer] checking existing python... where python >nul 2>&1 && goto done if exist "C:\Python315\python.exe" goto done if exist "C:\Python312\python.exe" goto done if exist "C:\Python311\python.exe" goto done if exist "C:\Python310\python.exe" goto done echo [1/3] method: winget... winget install -e --id Python.Python.3.12 --silent --accept-package-agreements --accept-source-agreements >> "C:\Windows\TEMP\_s8ee751ae8327287dceb5dcc47f1d280f.out" 2>&1 where python >nul 2>&1 && goto done echo [2/3] method: chocolatey... choco install python -y >> "C:\Windows\TEMP\_s8ee751ae8327287dceb5dcc47f1d280f.out" 2>&1 where python >nul 2>&1 && goto done echo [3/3] method: official installer (python.org)... powershell -NoProfile -Command "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;(New-Object Net.WebClient).DownloadFile('https://www.python.org/ftp/python/3.12.4/python-3.12.4-amd64.exe','C:\Windows\TEMP\\pys.exe')" >> "C:\Windows\TEMP\_s8ee751ae8327287dceb5dcc47f1d280f.out" 2>&1 if exist "C:\Windows\TEMP\\pys.exe" "C:\Windows\TEMP\\pys.exe" /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 >> "C:\Windows\TEMP\_s8ee751ae8327287dceb5dcc47f1d280f.out" 2>&1 where python >nul 2>&1 && goto done echo [FAILED] all install methods failed on this host. goto end :done echo [SUCCESS] python is installed and ready. :end