Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Clear UE4 Binaries, Intermediate and Regenerate VS
set dt=%DATE:~6,4%.%DATE:~3,2%.%DATE:~0,2%-%TIME:~0,2%.%TIME:~3,2%.%TIME:~6,2%
set dtstamp=%dt: =0%
set projectPath=""
set projectName=""
setlocal enableDelayedExpansion
set /a ID=0
echo "removing cache"
echo "--searching root"
if EXIST Binaries (
echo "----cleared Binaries"
RD /S /Q Binaries
if EXIST Intermediate (
echo "----cleared Intermediate"
RD /S /Q Intermediate
for /D %%i in (Plugins\*) do (
echo "--searching %%i"
if EXIST "%%i\Binaries" (
echo "----cleared Binaries"
RD /S /Q "%%i\Binaries"
if EXIST "%%i\Intermediate" (
echo "----cleared Intermediate"
RD /S /Q "%%i\Intermediate"
echo "Locating Engine"
if not EXIST "UE4ClearCacheEnginePath.txt" (
set /p cacheEnginePath="Engine Path: "
if defined cacheEnginePath (
echo "Creating Cache Engine Path"
echo %cacheEnginePath%> UE4ClearCacheEnginePath.txt
for /f "delims=" %%i in ('type UE4ClearCacheEnginePath.txt') do set enginePath=!enginePath!%%i
if not EXIST "%enginePath%" (
echo "%enginePath% is not a valid path"
) else (
echo "Engine Found: %enginePath%"
set buildToolPath=%enginePath%/Engine/Binaries/DotNET/UnrealBuildTool.exe
echo "searching root for UProject"
for /f "delims=" %%G in ('dir *.uproject /b') do (
set filename[!ID!]=%%~G
set /a ID+=1
set projectName = %%~G
set projectPath=%CD%\%%~G
@echo "--%ID% UProject(s) Found"
set logPath=%CD%\Saved\Logs\UnrealVersionSelector-%dtstamp%.log
if %ID% GTR 0 (
echo "--rebuilding projectName"
echo "buildToolPath: %buildToolPath%"
echo "logPath: %logPath%"
start "" "%buildToolPath%" -projectfiles -project="%projectPath%" -game -rocket -progress -log="%logPath%"

This comment has been minimized.

Copy link
Owner Author

@AaronTrotter AaronTrotter commented May 18, 2020

Place this in root directory.
It will ask you for the engine path once. This is required to regenerate Visual Studio project. It will create a file called UE4ClearCacheEnginePath in the root directory. Exclude it from git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment