这里使用了类似obj的数组,虽然bat中没有数组……
1.设置数组数据
set arr[0].type=feat
set arr[0].desc=新增功能
类似于这样的结构,其中的type与desc内容是根据 karma的Git日志规约 所编写的
2.遍历数组数据
设置数组遍历长度
set len=9
set index=0
:loop1
if %index% equ %len% goto :break1
set current.type=0
set current.desc=0
for /f "usebackq delims==. tokens=1-3" %%I in (`set arr[%index%]`) do ( set current.%%J=%%K )
echo [%index%] %current.type%%current.desc%
set /A index=%index% + 1
goto loop1
:break1
如果要根据数组type
定位取值的话:
echo [%index%] %current.type%%current.desc%
=>
if %index% equ %type% (
set select=%current.type%
goto break2
)
3.增加模版日志信息
这里用了logmsgfile没用logmsg是因为题主增加了换行,logmsg没办法支持换行
%svn% /command:commit /path:%project% /closeonend:1 /logmsgfile:%temp%\format.txt