使用for和goto实现分割字符串
set tmpStr=a,b,c
:Loop
for /f "tokens=1,* delims=," %%a in ("%tmpStr%") do (
echo %%a
set tmpStr=%%b
)
if "%tmpStr%" EQU "" (
goto End
)
goto Loop
:End
输出结果
a
b
c
2024-03-18 09:50:58
使用for和goto实现分割字符串
set tmpStr=a,b,c
:Loop
for /f "tokens=1,* delims=," %%a in ("%tmpStr%") do (
echo %%a
set tmpStr=%%b
)
if "%tmpStr%" EQU "" (
goto End
)
goto Loop
:End
输出结果
a
b
c