Skip to content

Instantly share code, notes, and snippets.

@stanbot8
Last active February 6, 2026 02:13
Show Gist options
  • Select an option

  • Save stanbot8/bbdef3c56f31e1ad92d1104b99526808 to your computer and use it in GitHub Desktop.

Select an option

Save stanbot8/bbdef3c56f31e1ad92d1104b99526808 to your computer and use it in GitHub Desktop.
One-click Unreal Engine project builder. Auto-detects .uproject and engine version, generates project files, builds, and launches the editor. Drop into your project root and run it.
@echo off
setlocal enabledelayedexpansion
:: === AUTO-DETECT PROJECT ===
set "SCRIPT_DIR=%~dp0"
cd /d "%SCRIPT_DIR%"
set "PROJECT_PATH="
for %%f in (*.uproject) do set "PROJECT_PATH=%SCRIPT_DIR%%%f"
if not defined PROJECT_PATH (
echo ERROR: No .uproject file found in %SCRIPT_DIR%
pause
exit /b 1
)
for %%f in ("%PROJECT_PATH%") do set "PROJECT_NAME=%%~nf"
echo Found project: %PROJECT_NAME%
:: === AUTO-DETECT ENGINE ===
set "ENGINE_ID="
for /f "tokens=2 delims=:," %%a in ('findstr /i "EngineAssociation" "%PROJECT_PATH%"') do (
set "ENGINE_ID=%%~a"
set "ENGINE_ID=!ENGINE_ID: =!"
set "ENGINE_ID=!ENGINE_ID:"=!"
)
echo Engine: %ENGINE_ID%
set "UE_ROOT="
for /f "tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\EpicGames\Unreal Engine\%ENGINE_ID%" /v "InstalledDirectory" 2^>nul') do set "UE_ROOT=%%b"
if not defined UE_ROOT if exist "C:\Program Files\Epic Games\UE_%ENGINE_ID%" set "UE_ROOT=C:\Program Files\Epic Games\UE_%ENGINE_ID%"
if not defined UE_ROOT if exist "D:\Program Files\Epic Games\UE_%ENGINE_ID%" set "UE_ROOT=D:\Program Files\Epic Games\UE_%ENGINE_ID%"
if not defined UE_ROOT if exist "%SCRIPT_DIR%..\Engine\Build\BatchFiles\Build.bat" set "UE_ROOT=%SCRIPT_DIR%.."
if not defined UE_ROOT (
echo ERROR: Could not find Unreal Engine %ENGINE_ID%
pause
exit /b 1
)
echo Engine Root: %UE_ROOT%
:: === CONFIG ===
set "BUILD_CONFIG=Development"
set "BUILD_PLATFORM=Win64"
set "TARGET=%PROJECT_NAME%Editor"
set "UBT_PATH=%UE_ROOT%\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.exe"
set "EDITOR_PATH=%UE_ROOT%\Engine\Binaries\Win64\UnrealEditor.exe"
:: === 1. GENERATE PROJECT FILES ===
echo.
echo [1/2] Generating project files...
"%UBT_PATH%" -projectfiles -project="%PROJECT_PATH%" -game -engine -progress
if %errorlevel% neq 0 (
echo ERROR: Failed to generate project files.
pause
exit /b 1
)
:: === 2. BUILD ===
echo.
echo [2/2] Building %TARGET% (%BUILD_CONFIG% ^| %BUILD_PLATFORM%)...
call "%UE_ROOT%\Engine\Build\BatchFiles\Build.bat" %TARGET% %BUILD_PLATFORM% %BUILD_CONFIG% -project="%PROJECT_PATH%" -WaitMutex
if %errorlevel% neq 0 (
echo.
echo ERROR: Build failed.
pause
exit /b 1
)
echo.
echo ========================================
echo BUILD COMPLETE
echo ========================================
:: === 3. LAUNCH EDITOR ===
echo.
echo Launching Unreal Editor...
start "" "%EDITOR_PATH%" "%PROJECT_PATH%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment