Absolute Beginners Guide to A+ Certification. Covers the Hardware and Operating Systems Exam

 <  Day Day Up  >  

Using ATTRIB

The ATTRIB utility is important to understand because the correct setting of file and folder attributes is vital to the correct operation of Windows. ATTRIB is used to view and set basic file attributes (archive, read-only, system, and hidden).

Folders can also have these attributes; for example, the folder C:\Windows\Fonts has the system attribute. A file or folder can have multiple attributes; for example, the Msdos.sys file used by Windows 9x/Me has system, hidden, and read-only attributes. If you need to edit Msdos.sys , you must use ATTRIB to remove these attributes before changing the file, and reapply these attributes after changing the file.

To see or set advanced attributes such as encrypted, compressed, or creation date, use the Windows GUI.

Options for ATTRIB in Windows 9x/Me include

C:\>attrib /? Displays or changes file attributes. ATTRIB [+R -R] [+A -A] [+S -S] [+H -H] [[drive:][path]filename] [/S] + Sets an attribute. - Clears an attribute. R Read-only file attribute. A Archive file attribute. S System file attribute. H Hidden file attribute. /S Processes files in all directories in the specified path.

Windows 2000/XP add the following option:

/D Processes folders as well.

When the ATTRIB command is run from the Windows 2000/XP Recovery Console, the /S and /D options are not available, but +C can be used to compress a file and -C can be used to uncompress a file.

Here are some examples:

  • ATTRIB ” Displays all files in the current folder with attributes ( A for archive; R for read-only; S for system; H for hidden).

  • ATTRIB +R Command.com ” Sets the file Command.com to have the read-only attribute.

  • ATTRIB -H -R -S C:\MSDOS.SYS ” Removes the hidden, read-only, and system attributes from the Msdos.sys file in the root folder of drive C:.

  • ATTRIB +H +R +S C:\MSDOS.SYS ” Restores the hidden, read-only, and system attributes to the Msdos.sys file in the root folder of drive C:.

  • ATTRIB +C *.doc ” Compresses all .doc files in the current folder (valid for Windows 2000/XP Recovery Console only).

 <  Day Day Up  >  

Категории