Attrib
From HowToGeek
The attrib command allows you to display or change the attributes of a file from the command prompt in Windows.
Contents |
Usage
The most common usage of this file is to set or unset the hidden or read-only attributes. The syntax for this is:
attrib <option> <filename>
Display File Attributes
You can display the attributes of a file by simply typing attrib and then the name of the file:
C:\>attrib application.log A C:\application.log
Hide or Unhide a File
To change the file attribute to a hidden file, use the following syntax:
attrib +h <filename>
To remove the hidden attribute, use the following syntax:
attrib -h <filename>
Make a File Read-Only or Writable
To set a file to be read-only, use the following syntax:
attrib -r <filename>
To make a file read-only, use the following syntax:
attrib +r <filename>
Combining Attributes
You can combine these attributes as well as the others into a single command, for instance to set a file as hidden and read-only, use this syntax:
attrib +h +r <filename>
Full Syntax
You can see the full syntax for this command (and most commands in Windows) by typing attrib /? at the command prompt:
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I]
[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.
I Not content indexed file 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
