去看这里的实例
http://www.cn-dos.net/forum/viewthread.php?tid=46126&fpage=2
"delims="
文本文件的内容for把它的每一行分成若干段。分段的符号叫定界符,系统默认是空格。
delims就是define limite定义界限的意思。"delims= "就是说定界是一空格符号把每行划分
为若干段。这是系统默认,此时可以不要delims=空格,也是一样的。如果这句改成delims=k,妈妈每行就按字母k划分为若干段。for默认只抓取每行的第一段进入内存,进行运算。
比如说*.txt的内容是
11 12 13
21 22 23
31 32 33
则for抓取的就是
11
21
31
特别注意 你这句里面for不会抓取整行的数据。只会抓取每行的第一段!如果你要让for抓取整行的
数据的话,你得添点破坏剂,就是 tokens=*
”%%~ni“
这里n来自英文name即名字的意思。~符号代表删除双引号。所以 ”%%~ni“就是指把参数%%i读取的文件名加以拓广。如何拓广?比如说%%i 如果代表的是文件名123456.txt,那么%%~ni就代表: 123456
而%%~xi就代表: .txt(x就是extended扩展的意思)
if not "%%~ni"=="%~n0" 就是:如果%%~ni 从%i获得的文件名字不等于 %~n0从%0获得的文件名字
(不含扩展名)则怎么怎么样。
Last edited by 5yue5 on 2009-2-15 at 22:56 ]
Go to see the example here
http://www.cn-dos.net/forum/viewthread.php?tid=46126&fpage=2
"delims="
The content of the text file is divided into several segments by each line by for. The symbol for segmenting is called a delimiter, and the system default is a space.
delims means define limite to define the boundary. "delims= " means that the delimiter is a space symbol to divide each line into several segments. This is the system default, and at this time, you can not have delims=space, which is also the same. If this sentence is changed to delims=k, each line will be divided into several segments according to the letter k. for by default only captures the first segment of each line into memory for operation.
For example, the content of *.txt is
11 12 13
21 22 23
31 32 33
Then what for captures is
11
21
31
Special note: This for will not capture the entire line of data. It will only capture the first segment of each line! If you want for to capture the entire line of data, you have to add a disruptor, that is, tokens=*
”%%~ni“
Here n comes from the English name, which means name. The ~ symbol represents removing the double quotes. So "%%~ni" means to expand the file name read by parameter %%i. How to expand? For example, if %%i represents the file name 123456.txt, then %%~ni represents: 123456
And %%~xi represents:.txt (x is the meaning of extended)
if not "%%~ni"=="%~n0" is: if the file name obtained from %%~ni from %i is not equal to the file name obtained from %~n0 from %0 (without extension), then what.
Last edited by 5yue5 on 2009-2-15 at 22:56 ]