Dire bat d&d

broken image
broken image

The option /d /r is undocumented, but can be a useful combination, while it will recurse through all subfolders the wildcard will only match against Folder/Directory names (not filenames). If specifying a full path to any of the folders, the path separators must use a backslash, not a forward slash. If any path in the the folder_set includes spaces, then surround the path with double quotes. if you are looping through multiple folders to find the exact folder January you could instead specify Janu?ry In many cases you can work around this by adding a single character wildcard e.g. Unlike other variants of the FOR command you must include a wildcard (either * or ?) in the ' folder_set' to get consistent results returned. In all cases for /d will start searching from the current directory.

broken image
broken image

r : Recurse into subfolders (see notes below) In a batch file use %%G (on the command line %G) In ( brackets), several commands, one per line. This can be a single command, or if you enclose it SyntaxįOR /D %% parameter IN ( folder_set) DO commandįolder_set : A set of one or more folders enclosed in parentheses (folder1,folder2).Ĭommand : The command to carry out, including any parameters. Conditionally perform a command on several Directories/Folders.