Posted on 2011-04-08 10:03
S.l.e!ep.¢% 阅读(2962)
评论(0) 编辑 收藏 引用 所属分类:
DOS
SET Obj_Length=2
SET Obj[0].Name=Test1
SET Obj[0].Value=Hello World
SET Obj[1].Name=Test2
SET Obj[1].Value=blahblah
SET Obj_Index=0
:LoopStart
IF %Obj_Index% EQU %Obj_Length% GOTO :EOF
SET Obj_Current.Name=0
SET Obj_Current.Value=0
FOR /F"usebackq delims==. tokens=1-3"%%I IN (`SET Obj[%Obj_Index%]`) DO (
SET Obj_Current.%%J=%%K
)
ECHO Name = %Obj_Current.Name%
ECHO Value = %Obj_Current.Value%
ECHO.
SET /AObj_Index=%Obj_Index% + 1
GOTO LoopStart
--
输出结果:
Name = Test1
Value = Hello World
Name = Test2
Value = blahblah