请教大家:
如下的一个功能需求:
解析字符串:
QQ,c:\program files\QQ|MSN,c:\program files\MSN|messager,c:\program files\messager
以"|"字符作为分隔符,分隔后的字符:
QQ,c:\program files\QQ
MSN,c:\program files\MSN
messager,c:\program files\messager
我的问题:
set V_productInstalloc="QQ,c:\program files\QQ|MSN,c:\program files\MSN|messager,c:\program files\messager"
for /f "tokens=1,2 delims=|" %%i in ("%V_productInstalloc%") do (
echo %%i
)
在V_productInstalloc中保存的工具名及其安装目录数不定,上例中为3个,而要想将每个子串都进行输出的话,需要用:
echo %%i
echo %%j
echo %%k
矛盾在于,这里必须明确知道子串的个数。
请问:如何输出字符串 V_productInstalloc(子串个数不定)的每一个子串?
谢谢
如下的一个功能需求:
解析字符串:
QQ,c:\program files\QQ|MSN,c:\program files\MSN|messager,c:\program files\messager
以"|"字符作为分隔符,分隔后的字符:
QQ,c:\program files\QQ
MSN,c:\program files\MSN
messager,c:\program files\messager
我的问题:
set V_productInstalloc="QQ,c:\program files\QQ|MSN,c:\program files\MSN|messager,c:\program files\messager"
for /f "tokens=1,2 delims=|" %%i in ("%V_productInstalloc%") do (
echo %%i
)
在V_productInstalloc中保存的工具名及其安装目录数不定,上例中为3个,而要想将每个子串都进行输出的话,需要用:
echo %%i
echo %%j
echo %%k
矛盾在于,这里必须明确知道子串的个数。
请问:如何输出字符串 V_productInstalloc(子串个数不定)的每一个子串?
谢谢
