I need to run "create.exe"
for each value in RS_NAME[ ]
.
One of the parameters that "create.exe"
requires is the FILE_CONFIG[ ]
which should correspond to the RS_NAME[ ] --> FILE_CONFIG[0] for RS_NAME[0]
.
I cannot figure out how to correctly pass the respective FILE_CONFIG[ ]
value into CALL command. I tried to use another FOR loop to no avail.
Any help would be appreciated.
Thank you!
SETLOCAL EnableDelayedExpansion
@echo off
...
...
SET RS_NAME[0]=Application1
SET RS_NAME[1]=Application2
SET RS_NAME[2]=
SET RS_NAME[3]=
REM FILE_PARAMS[0] corresponds to RS_NAME[0] and so on.
SET FILE_CONFIG[0]=C:\Users\Administrator\Desktop\Application1Params.xml
SET FILE_CONFIG[1]=C:\Users\Administrator\Desktop\Application2Params.xml
SET FILE_CONFIG[2]=
SET FILE_CONFIG[3]=
For /F "tokens=2 delims==" %%s in ('set RS_NAME[') do (
:: Displaying all information and writing it to "LOGFILE"
call %PATH_TO_EXEC%create.exe -action info -user %USER% -pass %PASSWORD%
timeout %TIMEOUT% >>%LOGFILE%
:: Finding "RS_NAME" in the "LOGFILE" and if not present, then create one
findstr /m %%s %LOGFILE%
if !errorlevel!==0 (
echo ### ------ERROR------### RS_NAME ### %%s ### ALREADY EXISTS
exit /b
)
if !errorlevel!==1 (
call %PATH_TO_EXEC%create.exe -action create -name %%s -fileconfig
%FILE_CONFIG% -version %VERSION% -type %TYPE% -user %USER% -pass
%PASSWORD% -timeout %TIMEOUT%
if !errorlevel! neq 0 (
echo ### ------ERROR------ ### Failed to create resource: %%s.
exit /b !errorlevel!
)
if !errorlevel! equ 0 (
echo ### ------SUCCESS------ ### Created Successfully
)
)
)