@FINDNEXT[[filename[,[ ][-]rhsadecijopt]]]:  Returns the name of the next file that matches the filename(s) in the previous @FINDFIRST call. Returns an empty string when no more files match. @FINDNEXT should only be used after a successful call to @FINDFIRST.


You do not need to include the filename parameter, because it must be the same as the one used in the previous @FINDFIRST call, unless you want to change the file attributes for @FINDNEXT. Filename, if used, must be in quotes if it contains white space or special characters.


If filename is quoted, the returned filename will also be quoted (if necessary).


The attribute parameter, if included, defines the attributes of the files that will be included in the search as specified in Attribute Switches.


Range parameters may not be used in this function. The range parameters specified in the preceding @FINDFIRST call remain effective.


If you don't need to change the attribute parameters established by the preceding @FINDFIRST, you can simply use this function as %@FINDNEXT[] without parameters.


On an LFN drive, the returned filename may contain white space or other special characters. Unlike @EXPAND[], no double quotes are added by this function. To avoid problems which could be caused by these characters, quote the returned name before you pass it to other commands. See the notes under Variable Functions for additional details.


@FINDFIRST[] locates the first file matching the requirements. To find more matching files, you must use @FINDNEXT[], and terminate the search with @FINDCLOSE[].




echo %@findfirst[*]

echo %@findnext[]

echo %@findnext[*,d]

echo %@findclose[]