I'm giving user options to select certain properties on command line. User want to select comma separated list. So user will see something like this
- Prop1
- Prop2
- Prop3
So user can give 1,3 and hit enter and user will get 1 and 3 databases created. But these Prop1, Prop2, Prop3 has unique names and ids, which I've given in same batch script as properties and I want to concat all those depending on options user has selected and pass to my build script.
Example of properties:
SET propertyID1=11
SET propertyID2=12
SET propertyID3=13
SET propertyID4=14
SET propertyID5=15
SET propertyIDPref1=011
SET propertyIDPref2=012
SET propertyIDPref3=013
SET propertyIDPref4=014
SET propertyIDPref4=015
SET propertyName1=A
SET propertyName2=B
SET propertyName3=C
SET propertyName4=D
SET propertyName5=E
call :parse "%M%"
pause
goto :eof
:parse
setlocal
set list=%~1
for /F "tokens=1* delims=," %%f in ("%list%") do (
if not "%%f" == "" call :getLineNumber %%f
if not "%%g" == "" call :parse "%%g"
if "%%g" == "" call :printPropertiesConcatenation
)
endlocal
goto :eof
:printPropertiesConcatenation
setLocal
echo "Gr8 " %buildPropertiesList%
endLocal
goto :eof
:getLineNumber
setlocal
echo file name is %1
set propID = 'propertyID'%1%
set propStr=propertyID
set propID=%1
set newvar=!%propStr%%propID%!
echo %newvar%
set propNameStr=propertyName
set propName=!%propNameStr%%propID%!
echo %propName%
set propIDPrefix=propertyIDPref
set propIDPrefixWithPrefix=!%propIDPrefix%%propID%!
echo %propIDPrefixWithPrefix%
set buildPropertiesList=%buildPropertiesList%','!%propIDPrefix%%propID%!
goto :eof
I can read correct values from these properties on iteration and see it using echo in loop. But I want to concat these values and pass it to build script. But I don't get way to see all concatenated values in one variable.
I want something like this. set propNames = A,C and set propIds = 11,13 in the end so that I can pass propNames and PropIds.
From above code I want buildPropertiesList to have 011,013
Is there any way