コマンドラインで特定のプロパティを選択するオプションをユーザーに提供しています。ユーザーがコンマ区切りのリストを選択したい。したがって、ユーザーには次のようなものが表示されます
- プロップ1
- プロップ2
- プロップ3
したがって、ユーザーは 1,3 を指定して Enter キーを押すと、1 と 3 のデータベースが作成されます。しかし、これらの Prop1、Prop2、Prop3 には一意の名前と ID があり、プロパティと同じバッチ スクリプトで指定したので、ユーザーが選択したオプションに応じてそれらすべてを連結し、ビルド スクリプトに渡します。
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
繰り返しでこれらのプロパティから正しい値を読み取り、echo in loop を使用して確認できます。しかし、これらの値を連結してビルドスクリプトに渡したいです。しかし、1 つの変数にすべての連結された値を表示する方法がありません。
私はこのようなものが欲しいです。最後に propNames = A,C を設定し、propIds = 11,13 を設定して、propNames と PropIds を渡すことができるようにします。
上記のコードから、buildPropertiesList に 011,013 を持たせたい
何か方法はありますか