Because I need to create folders in batches, I learned about the use of FOR, but the task is done, but the study of FOR can't be completed, and I was tripped up by TOKEN~~~
When I type for /? in the command line, the explanation is not understandable. Please ask everyone:
eol=c - refers to the end of a line comment character (just one) ________I understand this, it indicates what is a comment line and is ignored
skip=n - refers to the number of lines to ignore at the beginning of the file. ________This is also clear
delims=xxx - refers to the delimiter set. This replaces the default delimiter set of spaces and tabs. ________This seems to be clear. In the experiment, it seems to refer to starting to work from the specified character
tokens=x,y,m-n - refers to which symbol of each line is passed to the for itself in each iteration. This leads to the format of additional variable names as a range. Specify the m symbol through the nth symbol. If the asterisk is the last character in the string, then the additional variable will be assigned and accept the reserved text of the line after the last symbol is parsed. ________This is completely confused. The more I test, the more confused I am, a complete mess.
tokens=x,y,m-n
I don't understand the functions of x, y, m-n in the usage parameters of tokens. Which expert can explain it?
If you have time, please continue to read below. If you don't have time, just give two pointers. Thank you first.
This is the content of the text file t1.txt that I used for the experiment
The following is the test process
When I type for /? in the command line, the explanation is not understandable. Please ask everyone:
eol=c - refers to the end of a line comment character (just one) ________I understand this, it indicates what is a comment line and is ignored
skip=n - refers to the number of lines to ignore at the beginning of the file. ________This is also clear
delims=xxx - refers to the delimiter set. This replaces the default delimiter set of spaces and tabs. ________This seems to be clear. In the experiment, it seems to refer to starting to work from the specified character
tokens=x,y,m-n - refers to which symbol of each line is passed to the for itself in each iteration. This leads to the format of additional variable names as a range. Specify the m symbol through the nth symbol. If the asterisk is the last character in the string, then the additional variable will be assigned and accept the reserved text of the line after the last symbol is parsed. ________This is completely confused. The more I test, the more confused I am, a complete mess.
tokens=x,y,m-n
I don't understand the functions of x, y, m-n in the usage parameters of tokens. Which expert can explain it?
If you have time, please continue to read below. If you don't have time, just give two pointers. Thank you first.
This is the content of the text file t1.txt that I used for the experiment
In order to hold back the fleeting feelings,
I have to pick up the pen,
Write down the bits and pieces of this forbidden love.
Maybe dark, maybe cruel, maybe alternative,
But no one can deny the truest kindness and selflessness of the characters in it.
May everyone accompany them to the destined end.
The following is the test process
E:\>for /f "eol=为 tokens=2 delims=a " %1 in (t1.txt) do @echo %1
Have to pick up the pen,
Write down the bits and pieces of this forbidden love.
Maybe dark, maybe cruel, maybe alternative,
No one can deny the truest kindness and selflessness of the characters in it.
Everyone accompanies them to the destined end.
E:\>for /f "eol=为 tokens=1 delims=a " %1 in (t1.txt) do @echo %1
I
Write
Maybe
But
May
E:\>for /f "eol=为 tokens=3 delims=a " %1 in (t1.txt) do @echo %1
E:\>



