Definition of Attrib Command in the Network Encyclopedia.
What is Attrib Command?
ATTRIB is a Microsoft Windows command that can be used to display and modify the attributes of files and directories. You can use the attrib command to display and modify the archive, system, hidden, and read-only attributes that can be assigned to files and directories. For example, if you need to manually modify the boot.ini file on a machine running Windows NT, you can use the attrib command to remove its read-only, hidden, and system attributes.
Parameters of the attrib command
Parameter | Description |
{+|-}r | Sets (+) or clears (-) the Read-only file attribute. |
{+|-}a | Sets (+) or clears (-) the Archive file attribute. This attribute set marks files that have changed since the last time they were backed up. Note that the xcopy command uses archive attributes. |
{+|-}s | Sets (+) or clears (-) the System file attribute. If a file uses this attribute set, you must clear the attribute before you can change any other attributes for the file. |
{+|-}h | Sets (+) or clears (-) the Hidden file attribute. If a file uses this attribute set, you must clear the attribute before you can change any other attributes for the file. |
{+|-}i | Sets (+) or clears (-) the Not Content Indexed file attribute. |
[<drive>:][<path>][<filename>] | Specifies the location and name of the directory, file, or group of files for which you want to display or change attributes. You can use the ? and * wildcard characters in the filename parameter to display or change the attributes for a group of files. |
/s | Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories. |
/d | Applies attrib and any command-line options to directories. |
/l | Applies attrib and any command-line options to the Symbolic Link, rather than the target of the Symbolic Link. |
/? | Displays help at the command prompt. |
Attrib Command example
attrib –r –h –s boot.ini
The above command removes the read-only, hidden, and system attributes from the boot.ini file, allowing you to manually edit the file.