
If you want to process the File Names rather than the content of the files, use the FOR /F command_to_process variant, with DIR /b as the command. The DO command is then executed with the parameter(s) set to the token(s) found. In a batch file use %%G (on the command line %G)įOR /F processing of a text file consists of reading the file, one line of text at a time and then breaking the line up into individual items of data called 'tokens'. In ( parentheses), several commands, one per line. This can be a single command, or if you enclose it Use back quotes for ` command to process`įilenameset A set of one or more files, enclosed in parentheses (file1,file2).Ĭommand The command to carry out, including any parameters. Use double quotes for long file names in " filenameset". Instead of double quotes use single quotes for 'Text string to process' Usebackq Use the alternate quoting style:

Tokens= n Specifies which numbered items to read from each line Skip= n A number of lines to skip at the beginning of the file.Įol= Character at the start of each line to indicate a comment

SyntaxįOR /F %% parameter IN ( filenameset) DO commandįOR /F %% parameter IN ("Text string to process") DO commandĭelims= xxx The delimiter character(s). Loop command: against a set of files - conditionally perform a command against each item.
