- Read-only (R): Allowing the file to be only viewed and not written to.
- Archived (A): Allowing Microsoft backup and other backup programs to know what files to backup.
- Hidden (H): Making the file invisible to standard users.
- System (S): Making the file an important system file.
Syntax: attrib [+/-] [r/a/h/s] [filename]
- To Set the Read Only permission to Autoexec.bat present in C Drive, we need to run the Command: "attrib +r c:\autoexec.bat"
- To Remove the Read Only permission from Autoexec.bat, we need to run the Command: "attrib -r c:\autoexec.bat"
- To Set the Hidden permission to Autoexec.bat, we need to run the command: "attrib +h c:\autoexec.bat"
- To Remove the Hidden permission from Autoexec.bat, we need to run the Command: "attrib -h c:\autoexec.bat"
When you create any file or directory, Archive Attribute set by default. If you want to see the Attribute for each file, just run "attrib" Command and it will show you the present attribute. If you want to see the file with Read Only attribute, run "dir /ar" Command. Similarly for Hidden Attribute run "dir /ah" and for System Attribute run "dir /as".
In ideal DOS, it is not possible to delete any file having Read Only or Hidden attributes, but if you are working with Windows Shell, you can delete the file having these attributes.