Displays or sets file attributes. With no arguments, it displays the attributes of all files in the current directory. With no attribute modification instructions, it displays the attributes of the files and directories that match the given search wildcard specifications. Similar to chmod of other operating systems.
- To add an attribute, attach a '+' in front of its letter.
- To remove an attribute, attach a '-' in front of its letter
- A - Archived
- H - Hidden
- S - System
- R - Read-only
- ...and possibly others.
Displays the attributes of all files in the current directory.
Displays the attributes of the file.
attrib +r File.txt
Adds the "Read-only" attribute to the file.
attrib -a File.txt
Removes the "Archived" attribute from the file.
attrib -a +r File.txt
Removes the "Archived" attribute and adds the "Read-only" attribute to the file.
attrib +r *.txt
Acts on a set of files.
attrib /S +r *.txt
Acts recursively in sub-directories.
$ attrib /? Displays or changes file attributes. ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [+O | -O] [+I | -I] [+X | -X] [+P | -P] [+U | -U] [drive:][path][filename] [/S [/D]] [/L] + Sets an attribute. - Clears an attribute. R Read-only file attribute. A Archive file attribute. S System file attribute. H Hidden file attribute. O Offline attribute. I Not content indexed file attribute. X No scrub file attribute. V Integrity attribute. P Pinned attribute. U Unpinned attribute. B SMR Blob attribute. [drive:][path][filename] Specifies a file or files for attrib to process. /S Processes matching files in the current folder and all subfolders. /D Processes folders as well. /L Work on the attributes of the Symbolic Link versus the target of the Symbolic Link