Files
NexusLauncher/build.bat
2025-11-23 20:41:50 +08:00

62 lines
1.5 KiB
Batchfile

@echo off
echo ========================================
echo NexusLauncher Build Script
echo ========================================
echo.
echo [1/6] Check Python version...
python --version
if %errorlevel% neq 0 (
echo Error: Python not found, please ensure Python 3.11 or higher is installed
pause
exit /b 1
)
echo.
echo [2/6] Install dependencies...
pip install -r requirements.txt
if %errorlevel% neq 0 (
echo Error: Failed to install dependencies
pause
exit /b 1
)
echo.
echo [3/6] Close running instances...
taskkill /f /im NexusLauncher.exe 2>nul
if %errorlevel% equ 0 (
echo Closed NexusLauncher.exe
timeout /t 2 /nobreak >nul
) else (
echo No running instances found
)
echo.
echo [4/6] Clean build directory...
if exist "dist" rd /s /q "dist"
if exist "build" rd /s /q "build"
if exist "NexusLauncher.spec" del /f "NexusLauncher.spec"
echo.
echo [5/6] Build EXE using PyInstaller...
python -m PyInstaller --noconfirm --onefile --windowed --name "NexusLauncher" --icon="icons/NexusLauncher.ico" --add-data "icons;icons" main.py
if %errorlevel% neq 0 (
echo Error: Failed to build EXE
pause
exit /b 1
)
echo.
echo [6/6] Copy EXE to template folder...
copy /y /b "dist\NexusLauncher.exe" "D:\NexusLauncher\NexusLauncher.exe"
echo.
echo ========================================
echo Build completed!
echo Executable file location: D:\NexusLauncher\NexusLauncher.exe
echo ========================================
echo.
echo Opening D:\NexusLauncher folder...
start "" "D:\NexusLauncher"
echo.
pause