@ATTRIB[filename[,-rhsadecijlopt[,p]]] : If you do not specify any attributes, @ATTRIB returns the attributes of the specified file in the format RHSADECIJNOFTVPU, rather than 0 or 1. If two or more parameters are specified, @ATTRIB returns a 1 if the specified file has all the matching attribute(s); otherwise it returns a 0. If the optional third argument ,p is included (partial match), then @ATTRIB will return 1 if any of the attributes match

 

The basic attributes for FAT volumes are:

 

NNormal (no attributes set)
RRead-only
AArchive
HHidden
SSystem
DDirectory

 

In addition, NTFS volumes allow display of the following extended attributes:

 

EEncrypted
CCompressed
FSparse file
INot content-indexed
JJunction or symbolic link
LJunction or symbolic link
NNormal
OOffline
PPinned
TTemporary
UUnpinned
VVirtualized

 

The extended attributes are displayed when @ATTRIB is invoked with a single parameter, but they cannot be specified when querying files (two or more parameters). To query files based on the extended attributes, see @WATTRIB.

 

Attributes which are not set will be replaced with an underscore. For example, if SECURE.DAT has the read-only, hidden, and archive attributes set, %@ATTRIB[SECURE.DAT] would return RH_A_________. If the file does not exist, @ATTRIB returns an empty string.

 

The attributes (other than N) can be combined (for example %@ATTRIB[MYFILE,HS]). For example, %@ATTRIB[MYFILE,HS,p] will return 1 if MYFILE has the hidden, system, or both attributes. Without ,p the function will return 1 only if MYFILE has both attributes.

 

Filename must be in quotes if it contains white space or special characters.

 

See also: @WATTRIB, Attributes Switches and the ATTRIB command.

 

Examples:

 

echo %@attrib["C:\Program Files\My Program\myfile.exe",rhs,p]

 

echo Attributes for myfile.exe: %@attrib[myfile.exe]