ATTRIB

In computing,   is a command in Intel ISIS-II, DOS, IBM OS/2, Microsoft Windows and ReactOS that allows the user to change various characteristics, or "attributes" of a computer file or directory. The command is also available in the EFI shell.

History
Several operating systems provided a set of modifiable file characteristics that could be accessed and changed through a low-level system call. For example, as of release MS-DOS 4.0, the first six bits of the file attribute byte indicated whether or not a file was read-only (as opposed to writeable), hidden, a system file, a volume label, a subdirectory, or if the file had been "archived" (with the bit being set if the file had changed since the last use of the  command). However, initial releases of the operating system did not provide user-level method for reading or changing these values.

The initial version of the  command for DOS was first included in version 3.0 of PC DOS, with functionality limited to changing the read-only attribute. Subsequent versions allowed the read-only, hidden, system and archive bits to be set. MS-DOS version 3.3 added the capability of recursive searching through subdirectories to display attributes of specified files.

Digital Research DR DOS 6.0 and Datalight ROM-DOS also include an implementation of the ATTRIB command.

The FreeDOS version was developed by Phil Brutsche and is licensed under the GPLv2.

Uses
Setting the read-only bit of a file provided only partial protection against inadvertent deletion: while commands such as   and   would respect the attribute, other commands such as   did not. Changing the system attribute was not possible in early versions of Windows, thus requiring use of. Similarly, a system crash in early versions of Windows could lead to a situation where a temporary file had the read-only bit set and was additionally (and irrevocably) locked by the Windows OS; in this instance, booting into DOS (thus avoiding the Windows lock) and unsetting the read-only attribute with  was the recommended way of deleting the file. Manipulating the archive bit allowed users to control which files were backed up using the  command.