|
Syntax
Microsoft Windows 95, 98, and ME syntax
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [[drive:][path]filename]
[/S]
| + |
Sets an attribute. |
| - |
Clears an attribute. |
| R |
Read-only file attribute. |
| A |
Archive file attribute. |
| S |
System file attribute. |
| H |
Hidden file attribute. |
| /S |
Processes files in all directories in the specified path. |
Microsoft Windows 2000 and Windows XP syntax
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [[drive:] [path] filename] [/S [/D]]
| + |
Sets an attribute. |
| - |
Clears an attribute. |
| R |
Read-only file attribute. |
| A |
Archive file attribute. |
| S |
System file attribute. |
| H |
Hidden file attribute. |
| /S |
Processes files in all directories in the specified path. |
| /D |
Process folders
as well. |
Microsoft Windows 2000 and Windows XP recovery console
syntax
Note: The below options are the available options in
the Windows recovery console.
Changes attributes on one file or directory.
ATTRIB -R | +R | -S | +S | -H | +H | -C | +C filename
| + |
Sets an attribute. |
| - |
Clears an attribute. |
| R |
Read-only file attribute. |
| S |
System file attribute. |
| H |
Hidden file attribute. |
| C |
Compressed file attribute. |
Examples
attrib
Typing attrib by itself will display all files in
the current directory and each of their attributes. If any file
is hidden it will also display those files.
attrib +r autoexec.bat
Add the read-only attribute to the autoexec.bat
file so it cannot be modified until the read only attribute is taken off.
This is helpful for important system files or any other file
that you do not want to have mistakenly edited or changed by
another program.
attrib +h config.sys
Add the hidden attribute to the config.sys file
causing it to be not be seen by
the average user.
attrib -h config.sys
This command will do the opposite of the above command. Instead of
hiding the file it will unhide the file if hidden.
- Additional examples and information about displaying
hidden files in MS-DOS can be found on
document CH001039.
Extended information
See our File attributes
computer dictionary definition for additional information about file
attributes.
DOS directory file attribute bit position and Hex Value:
Bit Positions 7 6 5 4 3 2 1 0 |
Hex |
Description |
| 0 0 0 0 0 0 0 1 |
01h |
Read Only file |
| 0 0 0 0 0 0 1 0 |
02h |
Hidden file |
| 0 0 0 0 0 1 0 0 |
04h |
System file |
| 0 0 0 0 1 0 0 0 |
08h |
Volume Label |
| 0 0 0 1 0 0 0 0 |
10h |
Subdirectory |
| 0 0 1 0 0 0 0 0 |
20h |
Archive |
| 0 1 0 0 0 0 0 0 |
40h |
Reserved |
| 1 0 0 0 0 0 0 0 |
80h |
Reserved |
| Examples |
|
|
| 0 0 1 0 0 0 0 1 |
21h |
Read Only, Archive |
| 0 0 1 1 0 0 1 0 |
32h |
Hidden, Subdirectory, Archive |
| 0 0 1 0 0 1 1 1 |
27h |
Read Only, Hidden, Archive |
|