

This command works by implementing the recurse subdirectories flag on tools that are designed to process only a single file. Include special characters in the command line by using the hexadecimal code for the character, in 0x HH format (for example, 0x09 for a tab). Select files by an absolute date or a relative date by using the /d parameter.īuild an archive tree of files by using variables such as and files from directories by using the variable. Or you could execute every batch file (*.bat) on drive C, with the file name Myinput.txt as the first argument.

For example, you could run the type command on all files in a tree with the. The forfiles command lets you run a command on or pass arguments to multiple files. Otherwise, this variable evaluates to size, in modified date stamp on the modified time stamp on the file. You can use the following variables in the command string as specified by the /C command-line option: name without name path of the path of the to TRUE if a file type is a directory. The forfiles /S command is similar to dir /S. If no sign is specified, + is used by default.ĭisplays the help text in the cmd window. Valid values for days include any number in the range 0–32,768.Selects files with a last modified date later than or equal to ( +) the current date plus the number of days specified, or earlier than or equal to ( -) the current date minus the number of days specified.Selects files with a last modified date later than or equal to ( +) or earlier than or equal to ( -) the specified date, where date is in the format MM/DD/YYYY.Selects files with a last modified date within the specified time frame: This command is most commonly used in batch files. Selects and runs a command on a file or set of files.
