@FILESIZE[[/S[[+]n]] [range...] filename[,[scale[c][,a]]] : Returns the size of a file, or -1 if the file does not exist. If filename includes wildcards or an include list, it returns the combined size of all matching files. The optional third parameter a tells @FILESIZE to return the amount of space allocated for the file(s) on the disk. (Network drives and compressed drives may not always report allocated sizes accurately, depending on the way the network or disk compression software is implemented.)
Filename must be in quotes if it contains white space or special characters.
The second parameter specifies the reporting scale (see Memory Size / Disk Space / File Size Units and Report Format). Adding the letter c requests the result be formatted using the thousands separator.
The optional range parameter defines properties of the files that will be included in the result as specified in File Selection. Multiple range parameters may be included, but not more than one each of description range, size range, date range, and time range. Range parameters must precede filename. Exclusion ranges are not supported.
If you include the optional /S argument, @FILESIZE will search the current directory and all of its subdirectories for matching files. If you specify a number after the /S, @FILES will limit the subdirectory recursion to that number. For example, if you have a directory tree "\a\b\c\d\e", /S2 will only affect the "a", "b", and "c" directories.
If you specify a + followed by a number after the /S, @FILESIZE will not count any file sizes until it gets to that depth in the subdirectory tree. For example, if you have a directory tree \a\b\c\d\e, /S+2 will not count anything in \a or \a\b.
@FILESIZE supports returning the size of file streams. @FILESIZE also supports retrieving sizes for HTTP and HTTPS files. (Note that due to HTTP protocol limitations, you cannot use wildcards or scan subdirectories.)
Examples:
echo %@filesize[d:\path\myfile.ext]
417
echo %@filesize["%comspec",bc]
359,400
echo %@filesize["%comspec",bc,a]
360,448