For/f ["options"] % variable in (file-set) do command [command-parameters]
For/f ["options"] % variable in ("string") do command [command-parameters]
For/f ["options"] % variable in ('command') do command [command-parameters]
Optinos
EOL = C-refers to the end of a line comment character (just one) // ignore the line whose character starts
Skip = N-indicates the number of rows ignored at the beginning of the file.
Delims = xxx-refers to the delimiter set. This character replaces the space and the Skip key // specified to be separated into delims =;:. Use ";", ":", "." To separate
Default delimiter set.
Tokens = x, y, M-n-indicates which symbol of each row is passed to each iteration.
For itself. This leads to the allocation of additional variable names. M-n
Format is a range. Use the nth symbol to specify MTH. If
The asterisks of the last character in the symbol string,
Then the extra variable will be resolved after the last symbol
Distribute and accept reserved text of rows.
Usebackq-specify that the new syntax is used in the following situations:
A string enclosed in quotation marks when executed as a command and a single
The quotation mark character is a text string command and can be used in filenameset
Use double quotation marks to expand the file name.
Column
For/F "tokens = 1-3 delims =:." % 1 in ("% time %") Do @ echo % 1-% 2-% 3
Truncates and replaces the characters returned by % time %.
For/F "tokens = 2 delims =" % 1 in ("% date %") Do @ echo % 1
Truncation of characters returned by % date %
Use % date % + % time %
Create directory
Format
2004-10-12 @ 12-11
Year-month-day @ hour-minute
For/F "tokens = 2 delims =" % 1 in ("% date %") Do @ set D = % 1
For/F "tokens = 1-3 delims =:." % 1 in ("% time %") Do @ set T = % 1-% 2
Mkdir "% d % @ % T %"
Complete bat
-----------------------------------------
@ Echo off
Setlocal
For/F "tokens = 2 delims =" % 1 in ("% date %") Do @ set D = % 1
For/F "tokens = 1-3 delims =:." % 1 in ("% time %") Do @ set T = % 1-% 2
Mkdir "% d % @ % T %"
Endlocal
----------------------------------------