Explanation of the CMD attrib command
The attrib command is used to set or display file attributes.
Syntax:
attrib [+R|-R] [+A|-A] [+S|-S] [+H|-H] [drive:][path][filename] [/S [/D]]
Parameters:
+R: Set file as read-only attribute.
-R: Cancel file’s read-only attribute.
+A: Set file as archive attribute.
-A: Cancel file’s archive attribute.
+S: Set file as system attribute.
-S: Cancel file’s system attribute.
+H: Set file as hidden attribute.
-H: Cancel file’s hidden attribute.
/S: Recursively process all files in specified directory.
/D: Include all subdirectories when processing directories.
Example:
“The professor asked the students to complete the assignment by the end of the week.”
“The professor requested that the students finish the assignment by the end of the week.”
- Give C:\test.txt the attribute of being read-only.
- Remove the read-only attribute from the file test.txt.
- Set the attribute of the file test.txt to archive.
- Remove the archive attribute of test.txt file.
- attrib +S C:\test.txt sets the test.txt file as a system attribute.
- Remove the system attribute of the file named test.txt.
- Set the test.txt file to hidden by typing “attrib +H C:\test.txt”
- Remove the hidden attribute from the test.txt file.
- Set the attributes of the file test.txt to read-only and hidden.
- Recursively set all files in the test directory to read-only.