Attrib allows a user to change the properties of a specified file. Using Attrib, the user has the capability of changing the file to have any of the below attributes. This command is available in DOS 3.0 and above and Windows 95 and above. We need to apply(+) or (-) option to apply or remove the effect.
- 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]
Examples
- To Set the Read Only permission to Autoexec.bat present in CDrive, 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.
No comments:
Post a Comment