filmov
tv
For (/F) Loop in Batch File Programming
Показать описание
In this tutorial, we have discussed about For /F loop and different options like delims, skip, eol, token and usebackq with examples.
the syntax for this loop is like
FOR /F ["options"] %%parameter IN (filename) DO command
FOR /F ["options"] %%parameter IN ("Text string to process") DO command
options:
delims= The delimiter character(s) (default = a space)
skip=n A number of lines to skip at the beginning of the file. (default = 0)
eol=; Character at the start of each line to indicate a comment The default is a semicolon ;
tokens=n Specifies which numbered items to read from each line (default = 1)
usebackq Use the alternate quoting style:
- Use double quotes for long file names including spaces in "filename".
- Use single quotes for 'Text string to process'
- Use back quotes for `command to process`
tokens=1,2,3 will cause the first, second and third items on each line to be processed.
tokens=1-3 will cause the 1-3 items on each line to be processed.
tokens=* will cause all items on each line to be processed.
tokens=2* will process the third token and the 4th + all subsequent items, this can also be written as tokens=2,*
Please share and subscribe the video and for any doubt please comment in the comment section.
the syntax for this loop is like
FOR /F ["options"] %%parameter IN (filename) DO command
FOR /F ["options"] %%parameter IN ("Text string to process") DO command
options:
delims= The delimiter character(s) (default = a space)
skip=n A number of lines to skip at the beginning of the file. (default = 0)
eol=; Character at the start of each line to indicate a comment The default is a semicolon ;
tokens=n Specifies which numbered items to read from each line (default = 1)
usebackq Use the alternate quoting style:
- Use double quotes for long file names including spaces in "filename".
- Use single quotes for 'Text string to process'
- Use back quotes for `command to process`
tokens=1,2,3 will cause the first, second and third items on each line to be processed.
tokens=1-3 will cause the 1-3 items on each line to be processed.
tokens=* will cause all items on each line to be processed.
tokens=2* will process the third token and the 4th + all subsequent items, this can also be written as tokens=2,*
Please share and subscribe the video and for any doubt please comment in the comment section.
Комментарии