From 2187e3fc916f38036fbfc095d7eba6746f7d8238 Mon Sep 17 00:00:00 2001 From: penev92 Date: Mon, 20 Feb 2023 09:20:28 +0200 Subject: [PATCH] Added an option to run utility.cmd programatically From OpenRA PR 20010. --- utility.cmd | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/utility.cmd b/utility.cmd index 94fa76d..ae6ccb5 100644 --- a/utility.cmd +++ b/utility.cmd @@ -16,6 +16,32 @@ if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine >nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine cd %ENGINE_DIRECTORY% +set argC=0 +for %%x in (%*) do set /A argC+=1 + +if %argC% == 0 goto choosemod + +if %argC% == 1 ( + set MOD_ID=%1 + goto loop +) + +if %argC% GEQ 2 ( + @REM This option is for use by other scripts so we don't want any extra output here - before or after. + call bin\OpenRA.Utility.exe %* + EXIT /B 0 +) + +:choosemod +echo ---------------------------------------- +echo. +call bin\OpenRA.Utility.exe +echo Enter --exit to exit +set /P mod="Please enter a modname: OpenRA.Utility.exe " +if /I "%mod%" EQU "--exit" (exit /b) +set MOD_ID=%mod% +echo. + :loop echo. echo ---------------------------------------- @@ -24,12 +50,12 @@ echo Enter a utility command or --exit to exit. echo Press enter to view a list of valid utility commands. echo. -set /P command=Please enter a command: OpenRA.Utility.exe %MOD_ID% +set /P command="Please enter a command: OpenRA.Utility.exe %MOD_ID% " if /I "%command%" EQU "--exit" (cd %TEMPLATE_DIR% & exit /b) echo. echo ---------------------------------------- echo. -echo OpenRA.Utility.exe %MOD_ID% %command% +echo Starting OpenRA.Utility.exe %MOD_ID% %command% call bin\OpenRA.Utility.exe %MOD_ID% %command% goto loop