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.”

  1. Give C:\test.txt the attribute of being read-only.
  2. Remove the read-only attribute from the file test.txt.
  3. Set the attribute of the file test.txt to archive.
  4. Remove the archive attribute of test.txt file.
  5. attrib +S C:\test.txt sets the test.txt file as a system attribute.
  6. Remove the system attribute of the file named test.txt.
  7. Set the test.txt file to hidden by typing “attrib +H C:\test.txt”
  8. Remove the hidden attribute from the test.txt file.
  9. Set the attributes of the file test.txt to read-only and hidden.
  10. Recursively set all files in the test directory to read-only.
bannerAds