Undocummented info of FOR ~a expansion

Written by Carlos M.

In FOR commands %%~aI expands %%I to the file attributes of a file.

In the Windows NT family there are at least 14 attributes for files or directories.
FOR's %%~aI only recognizes 9 attributes.

The expansion of attribute of file is a series of 9 dashes.
Each recognized attribute replaces a dash with a letter.

A file without recognized attributes or without attributes is expanded like this: ---------

This is the list of recognized attributes by for command and your expansion:

Attribute Expansion
FILE_ATTRIBUTE_DIRECTORY d--------
FILE_ATTRIBUTE_READONLY -r-------
FILE_ATTRIBUTE_ARCHIVE --a------
FILE_ATTRIBUTE_HIDDEN ---h-----
FILE_ATTRIBUTE_SYSTEM ----s----
FILE_ATTRIBUTE_COMPRESSED -----c---
FILE_ATTRIBUTE_OFFLINE ------o--
FILE_ATTRIBUTE_TEMPORARY -------t-
FILE_ATTRIBUTE_REPARSE_POINT --------l

This is a list of not recognized attributes by for command:

FILE_ATTRIBUTE_NORMAL
FILE_ATTRIBUTE_ENCRYPTED
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
FILE_ATTRIBUTE_SPARSE_FILE
Note: FILE_ATTRIBUTE_NORMAL is the same as a file without attributes.
Example: Expansion of a file with attributes hidden and system is: ---hs----

page last uploaded: 2 October 2011, 21:44
Fileaze