-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallPython.bat
More file actions
executable file
·33 lines (31 loc) · 1.31 KB
/
InstallPython.bat
File metadata and controls
executable file
·33 lines (31 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@echo off
setlocal enabledelayedexpansion
for /f "tokens=2 delims==" %%a in ('wmic os get caption /value 2^>nul') do (
set "os_name=%%a"
)
set "os_name=!os_name:~0,-1!"
set "arch=%PROCESSOR_ARCHITECTURE%"
echo %os_name% | find /i "Windows" >nul
if "%arch%"=="AMD64" (
set "url=https://www.python.org/ftp/python/3.14.3/python-3.14.3-amd64.exe"
) else if "%arch%"=="ARM64" (
set "url=https://www.python.org/ftp/python/3.14.3/python-3.14.3-arm64.exe"
) else (
set "url=https://www.python.org/ftp/python/3.14.3/python-3.14.3.exe"
)
powershell -c "Write-Host 'Install Python: Download URL: !url!' -ForegroundColor Green"
if defined url (
set "tmp_exe=%TEMP%\python-installer-%RANDOM%.exe"
powershell -c "Write-Host 'Install Python: Generated Python Temp Path: !tmp_exe!' -ForegroundColor Green"
powershell -Command "(New-Object Net.WebClient).DownloadFile('!url!', '!tmp_exe!')"
if exist "!tmp_exe!" (
start "" "!tmp_exe!"
powershell -c "Write-Host 'Install Python: Python installer has been executed: !tmp_exe!' -ForegroundColor Green"
) else (
powershell -c "Write-Host 'Install Python: Failed to download Python installer.' -ForegroundColor Green"
)
timeout 5
) else (
powershell -c "Write-Host 'Install Python: Failed to set download URL.' -ForegroundColor Green"
)
endlocal