@echo off
verify # 2>nul
setlocal enableextensions enabledelayedexpansion
if errorlevel 1 goto CANT_SWITCH_ON_EXTENDED_CMD_PROCESSING
call #SETTINGS.cmd
if !errorlevel! neq 0 goto ERROR

if "%~0"=="RUN_R.cmd" goto START
cls
echo RUNNING THE APPLICATION (RELEASE):
echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

:START
if not exist "!#TargetModulePath_R!" goto TARGET_MODULE_NOT_FOUND
cls
set ASPNETCORE_ENVIRONMENT=
"!#TargetModulePath_R!"!#StartArgs_Auto! %*
if !errorlevel! neq 0 goto ERROR

goto FINISH

::==================================================================================================

:TARGET_MODULE_NOT_FOUND
echo.
echo ## Target module not found: "!#TargetModulePath_R!".
goto ERROR

:CANT_SWITCH_ON_EXTENDED_CMD_PROCESSING
echo.
echo ## Can not switch on extended command processing.
goto ERROR

::==================================================================================================
:RESET_ERROR
set errorlevel=0
set errorlevel=
goto :EOF
::==================================================================================================
:ERROR
if not "%~0"=="RUN_R.cmd" (
echo 
if not "%$cmd_plain%"=="1" pause )
endlocal
verify # 2>nul
goto :EOF
:FINISH
if not "%~0"=="RUN_R.cmd" if "%$cmd_plain%"=="1" echo.
endlocal
call :RESET_ERROR
goto :EOF
::==================================================================================================
