China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-07 13:15
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to use % as a delimiter in a for statement (solved) View 3,615 Replies 21
Floor 16 Posted 2006-12-16 07:15 ·  中国 江苏 南京 电信
高级用户
★★
Credits 623
Posts 214
Joined 2006-09-22 20:48
19-year member
UID 63387
Status Offline
And what I said is just how to use % as a delimiter, not how to remove %, what I said is not wrong, right? Everyone knows what's going on, let's not argue.
Floor 17 Posted 2006-12-16 07:21 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
I have a strong thirst for knowledge, but I am a person with a very good temper and don't care about these things. Everyone in the forum is friends. ^_^
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 18 Posted 2006-12-16 07:30 ·  中国 江苏 南京 电信
高级用户
★★
Credits 623
Posts 214
Joined 2006-09-22 20:48
19-year member
UID 63387
Status Offline
These days, I'm also in a bit of a bad mood. When I see something不顺, I want to say a few words. Please don't take it to heart. It's better to be in harmony.

However, it's because I saw your answers in http://www.cn-dos.net/forum/viewthread.php?tid=25647&fpage=1 that I have an opinion of you. The original poster was originally being kind to ask a question, but you all said such things like that (except for one person). Will you still dare to come to the forum in the future? I'm afraid the original poster is also very sad. Here, forum friends are like God. Just like in the commodity economy, customers are like God.

I'm just standing up for that original poster. I hope everyone can be a little better to new forum friends, so that the forum can develop better.

[ Last edited by tianzizhi on 2006-12-16 at 07:39 AM ]
Floor 19 Posted 2006-12-16 07:33 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Hehe, to be honest, I often do that. I just unplug it when leaving after eating. Generally, few people think of it, so the machine can't be used ^_^
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 20 Posted 2006-12-16 07:36 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Also, I've been emphasizing all the time that I'm not an expert, and I'm not being arrogant. Thank you, my speech is over.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 21 Posted 2006-12-16 07:49
中级用户
★★
DOS之日
Credits 337
Posts 161
Joined 2006-11-04 05:27
19-year member
UID 69523
Gender Male
Status Offline
This kind of quarreling can also enhance feelings. ^&^...
The method on the 3rd floor is correct. Using two % can be used as a delimiter in FOR.
The code on the 1st floor only outputs the first content after % separation. Since % is to be used as a delimiter, it should not be only outputting the content of the first item. So I think the 5th floor will say:

The code is incorrect unless you don't want the characters after the first %, otherwise the code is wrong.


In addition, there is another point. For "tokens=1 delims=%% in for /f", pay attention to the space after delims=%% "". If you want to use space as a delimiter at the same time, it can be, otherwise just add quotes and there should be no space in the middle.

[ Last edited by hxuan999 on 2006-12-15 at 07:50 PM ]
for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul
Floor 22 Posted 2007-07-12 17:21 ·  中国 河南 郑州 联通
初级用户
Credits 46
Posts 22
Joined 2006-08-06 13:27
19-year member
UID 59949
Gender Male
From 郑州
Status Offline
Learned it! You all are amazing!
Forum Jump: