From Infogalactic: the planetary knowledge core
Jump to: navigation, search

ATTRIB is a command, in DOS, OS/2 and Microsoft Windows that allows the user to change various characteristics, or "attributes" of a file or directory.


Several Microsoft 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 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 BACKUP command).[1] However, initial releases of the operating system did not provide user-level method for reading or changing these values.[2]


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


Setting the read-only bit of a file provided only partial protection against inadvertent deletion: while commands such as del and erase would respect the attribute, other commands such as DELTREE did not.[5] Changing the system attribute was not possible in early versions of Windows, thus requiring use of ATTRIB.[5] 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 ATTRIB was the recommended way of deleting the file.[6] Manipulating the archive bit allowed users to control which files were backed up using the BACKUP command.[2]

See also


  1. IBM Disk Operating System Version 4.00 Technical Reference (PDF) (1st ed.). July 1988. p. 3:5.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
  2. 2.0 2.1 2.2 Petzold, Charles (June 10, 1986). "Changing DOS File Attributes". PC Magazine. pp. 249&ndash, 262.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
  3. "DOS Attrib". Encyclopedia. PC Magazine. Retrieved 2007-08-02.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
  4. "Using ATTRIB, CHKDSK, or DIR Command to Locate Files". Microsoft. Retrieved September 2014. Check date values in: |accessdate= (help)<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
  5. 5.0 5.1 O'Reilly, Tim; Mott, Troy; Glenn, Walter J. (1999). Windows 98 in a Nutshell: A Desktop Quick Reference. O'Reilly. pp. 303&ndash, 306. ISBN 1-56592-486-X.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
  6. Jones, James G.; Landes, Craig (2003). A+ Exam Cram 2: Windows 2000 Directory Services Infrastructure. Que. pp. 309&ndash, 310. ISBN 0-7897-2867-2.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>

External links