-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bat
More file actions
101 lines (92 loc) · 3.32 KB
/
install.bat
File metadata and controls
101 lines (92 loc) · 3.32 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
@echo off
REM ----------------------------------------------------------
REM Auto-elevate to Administrator (avoid infinite loop)
REM ----------------------------------------------------------
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Administrator privileges required. Relaunching as administrator...
powershell -Command "Start-Process -FilePath '%~f0' -Verb RunAs -ArgumentList '--elevated'"
exit /b
)
if "%1"=="--elevated" shift
echo.
echo ==========================================
echo One-Click Environment Setup Script (Windows)
echo ==========================================
echo.
REM 1. Download & install Python 3.10.11 x64
echo [1/6] Downloading and installing Python 3.10.11 (x64)...
set "PYTHON_URL=https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe"
set "PYTHON_EXE=%TEMP%\python-3.10.11-amd64.exe"
powershell -Command "Invoke-WebRequest -Uri '%PYTHON_URL%' -OutFile '%PYTHON_EXE%'"
"%PYTHON_EXE%" /quiet InstallAllUsers=1 PrependPath=1 Include_pip=1
if errorlevel 1 (
echo ERROR: Failed to install Python.
pause & exit /b 1
)
del "%PYTHON_EXE%"
REM 2. Ensure pip is available
echo [2/6] Ensuring pip is available...
py -m ensurepip --default-pip 2>nul
if errorlevel 1 (
echo ensurepip failed. Bootstrapping get-pip.py...
set "GETPIP=%TEMP%\get-pip.py"
powershell -Command "Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile '%GETPIP%'"
py "%GETPIP%"
del "%GETPIP%"
)
py -m pip install --upgrade pip
if errorlevel 1 (
echo ERROR: Failed to upgrade pip.
pause & exit /b 1
)
REM 3. Download & install Git for Windows 2.50.0 x64
echo [3/6] Downloading and installing Git for Windows...
set "GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.50.0.windows.1/Git-2.50.0-64-bit.exe"
set "GIT_EXE=%TEMP%\Git-2.50.0-64-bit.exe"
powershell -Command "Invoke-WebRequest -Uri '%GIT_URL%' -OutFile '%GIT_EXE%'"
"%GIT_EXE%" /VERYSILENT /NORESTART /SP-
if errorlevel 1 (
echo ERROR: Failed to install Git.
pause & exit /b 1
)
del "%GIT_EXE%"
REM 3b. Add Git to current session PATH
echo [3b] Adding Git to PATH for this session...
set "GIT_INSTALL_DIR=%ProgramFiles%\Git\cmd"
set "PATH=%GIT_INSTALL_DIR%;%PATH%"
REM 4. Clone sample code to Desktop
echo [4/6] Cloning sample code to Desktop...
cd /d "%USERPROFILE%\Desktop"
if not exist example-code-2025 (
git clone https://github.com/CSIE-Camp/example-code-2025.git
if errorlevel 1 (
echo ERROR: Clone failed.
pause & exit /b 1
)
) else (
echo Directory already exists, skipping clone.
)
REM 5. Install Python dependencies
echo [5/6] Installing Python dependencies...
cd example-code-2025
pip install -r requirements.txt
if errorlevel 1 (
echo ERROR: Failed to install dependencies.
pause & exit /b 1
)
REM 6. Download & install Discord Desktop (x64, stable)
echo [6/6] Downloading and installing Discord Desktop...
set "DISCORD_URL=https://discord.com/api/downloads/distributions/app/installers/latest?channel=stable&platform=win&arch=x64"
set "DISCORD_EXE=%TEMP%\DiscordSetup.exe"
powershell -Command "Invoke-WebRequest -Uri '%DISCORD_URL%' -OutFile '%DISCORD_EXE%'"
"%DISCORD_EXE%" /S
if errorlevel 1 (
echo ERROR: Failed to install Discord.
pause & exit /b 1
)
del "%DISCORD_EXE%"
echo.
echo All tasks completed successfully! Press any key to exit.
pause
exit /b 0