ATTRIB
(from Attributes)
Shows or changes the attributes of one or more files (or a directory and/or its subdirectories).
ATTRIB [{+|-}attr [...]] [drive:][path][filename/directory] [/S] [/D] [/L]
Where:
+- Enables attribute.-- Disables attribute.attr- Specifies the attribute (cfr. Super User - Windows Explorer's file attribute column values):R- Read-only file attribute.A- Archive file attribute.S- System file attribute.H- Hidden file attribute.I- Non-indexed file attribute.T- Temporary file attribute.O- Offline file attribute.E- Encrypted file attribute.X- Clean file attribute (scrub flag, supported on ReFS volumes, introduced in Windows 8).V- On ReFS volumes (introduced in Windows 8): Healthy file attribute (integrity); on FAT volumes: Deprecated.P- Since Windows 10 v1703: Pinned file attribute (always available on OneDrive); before Windows 10 v1703: Sparse file attribute (allocates only non-null data on disk).U- Unpinned file attribute (online-only on OneDrive, introduced in Windows 10 v1703).M- Strictly sequential file attribute (introduced in Windows 10 v1703).B- Recall on data access file attribute (introduced in Windows 10).[drive:][path][filename/directory]- Specifies the file or files (or directory or directories) to process./S- Processes files in the specified directory and subdirectories./D- Also processes directories./L- Applies attributes to the symbolic link (if one is specified) rather than its target.
By not specifying the options +R, -R, +A, -A, +S, -S, +H, -H, etc… only the file or directory attributes are displayed. Not specifying [drive][path][filename/directory] will process the current directory (see CD or CHDIRCD or CHDIR).
Examples:
1. Display attributes of directory, subdirectories, files etc… of C:\WINDOWS\u:
attrib "C:\WINDOWS\u" /s /d
2. Change the attributes of the file C:\at work.bmp by enabling read-only and disabling hidden file attributes:
attrib +r -h "C:\at work.bmp"
Comments