中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-09 10:06
47,811 topics / 349,895 posts / today 0 new / 48,253 members
DOS批处理 & 脚本技术(批处理室) » [Help] Question about splitting with "delims=="?
Printable Version  1,092 / 7
Floor1 terrytong Posted 2008-07-30 11:22
中级用户 Posts 115 Credits 240
set /f "delims==" %a in ('set') do echo %a will display the content before the = sign.
But if I want to get the characters after the = sign, then what? Experts, please teach me.
Floor2 HAT Posted 2008-07-30 12:20
版主 Posts 5,017 Credits 9,023
Floor3 terrytong Posted 2008-07-30 13:27
中级用户 Posts 115 Credits 240
Originally posted by HAT at 2008-7-30 12:20:

I tried it, but it doesn't work. It just displays %b.
Floor4 yishanju Posted 2008-07-30 13:29
银牌会员 Posts 1,357 Credits 1,488
You probably need to add tokens.
Floor5 HAT Posted 2008-07-30 13:34
版主 Posts 5,017 Credits 9,023
Floor6 terrytong Posted 2008-07-30 13:47
中级用户 Posts 115 Credits 240
Originally posted by HAT at 2008-7-30 13:34:

It works now, thanks HAT.
Can you help explain it to me? Why does adding tokens=1,2 make it take the right side instead? But adding tokens=1 doesn't work.
Thanks.
Floor7 HAT Posted 2008-07-30 14:51
版主 Posts 5,017 Credits 9,023
tokens=1 means only taking the first column; at that point only %a is valid.
Floor8 yishanju Posted 2008-07-31 18:40
银牌会员 Posts 1,357 Credits 1,488
Actually... after for /?

there is a line like this, FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i
I only just noticed it myself
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023