Professional Documents
Culture Documents
What Is The Attrib Command
What Is The Attrib Command
What Is The Attrib Command
The attrib command is a Recovery Console command used to change the file
attributesfor a file or directory while in Recovery Console.
An attrib command is also available from the Command Prompt.
The attrib command is often used with many of the Recovery Console commands.
Windows 7 and Windows 8 syntax
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I] [drive:][path]
[filename] [/S [/D] [/L]]
+
Sets an attribute.
Clears an attribute.
Integrity attribute.
/S
/D
/L
Work on the attributes of the Symbolic Link versus the target of the Symbolic Link
See our attrib examples for information and examples on how to use this
command.
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.
/S
/D
See our attrib examples for information and examples on how to use this
command.
Microsoft Windows 2000 and Windows XP recovery console syntax
Note: The below options are the available options in the Windows recovery
console.
Sets an attribute.
Clears an attribute.
See our attrib examples for information and examples on how to use this
command.
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.
/S
Examples
attrib
Typing attrib by itself displays all files in the current directory and each of
their attributes. If any file is hidden it also displays those files.
As can be seen in the above example we typed the dir command to list the
files in the current directory and could only see the "computer.bat" file listed.
However, when we type attrib by itself, we can see that there are three files
in this directory, "computer.bat" with read-only, "example.txt" with hidden,
and "hope.txt" with the hidden and read-only attribute.
attrib +r autoexec.bat
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 does the opposite of the example shown before this
command. Instead of hiding the file this command makes the file visible if
hidden.
attrib +r +h autoexec.bat
Finally, this example adds two attributes to the autoexec.bat and makes the
file read-only as well as hidden.
Extended information
Most users never need to deal with a files bit position or hex value. However,
for those needing this information when working with MS-DOS and the
Windows command line below are the file attributes bit positions
and Hex Values with bit positions in the order of "7 6 5 4 3 2 1 0."
Bit Positions
Hex
Description
00000001
01h
Read-only file
00000010
02h
Hidden file
00000100
04h
System file
00001000
08h
Volume Label
00010000
10h
Subdirectory
00100000
20h
Archive
01000000
40h
Reserved
10000000
80h
Reserved
00100001
21h
Read-only, Archive
00110010
32h
00100111
27h
00100011
23h
Examples