@echo off
:checkPrivileges
net session >nul 2>&1
if %errorLevel% == 0 (
    goto gotPrivileges
) else (
    goto getPrivileges
)

:getPrivileges
if '%1'=='ELEV' (shift & goto gotPrivileges)
setlocal DisableDelayedExpansion
set "batchPath=%~f0"
setlocal EnableDelayedExpansion
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getAdmin.vbs"
echo UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\getAdmin.vbs"
"%temp%\getAdmin.vbs"
exit /B

:gotPrivileges
setlocal & cd /d %~dp0
if '%1'=='ELEV' (shift)

:: Your commands go here

IF NOT EXIST TS2Prototype\Releases\1.0\WindowsNoEditor\AssetRegistry.bin goto Error
start "" "%~dp0TS2Prototype\Binaries\Win64\TrainSimWorldPublicEditor.exe" "%~dp0TS2Prototype\TS2Prototype.uproject"

exit /B

:Error
echo You better first run generate.bat file because you dont have AssetRegistry.bin file generated
echo Without generated file you will not be able to cook.
pause
exit

