这样吵也可以增进感情呀.^&^...
3楼的方法就是正确的.用两个%就可以在FOR中做为分隔符.
1楼的代码只输出了%分隔后第一个内容,既然要用%作分隔符,那就不会是只输出第一项的内容吧,所以我想5楼才会说:
除非你不想要第一个%后面的字符,否则代码不对。
另外还有一点就是for /f "tokens=1 delims=%% 中的
delims=%% "",两个%%后面的空格要注意了,如果你想同时用空格作分隔符的化可以有,否则直接加引号,中间不要有空格.
Last edited by hxuan999 on 2006-12-15 at 07:50 PM ]
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 ]