DOS Command: ATTRIB (2024)


ATTRIB


Type: External (3.0 and later)

Syntax:

ATTRIB [d:][path]filename [/S]
ATTRIB [+ R|-R] [+A|-A] [+ H|-H] [+ S|-S] [d:][path]filename [/S]

Purpose:
Sets or displays the read-only, archive, system, and hidden attributes of a fileor directory.

Discussion

Using the ATTRIB command, you can change a file`s read/write attribute or set the archive attribute. If you use this command to specify a file as read-only, the file can be accessed, but not altered or deleted.

If a file has an attribute of -R, it can be both read from or written to (it is referred to as read/write). If a file has an attribute of +R, it can be read from, but not written to (for example, you can use your word processor to look at it but not to alter it).

NOTE:

If you try to erase a file after you have set its attribute to read-only (+R), DOS will display the words ACCESS DENIED. Before you can erase the file you must use the ATTRIB command to change the file`s attribute to read/write (-R).

The BACKUP, RESTORE, and XCOPY commands can use the archive attribute. You can use the +A or -A options to selectively back up using the BACKUP command. You can also use these options to selectively copy using the XCOPY command.

Wildcard characters (? and *) can be used. However, you CANNOT use a directory name instead of a filename to change the attributes of all files in a directory.

With DOS Version 5 and later you can hide data files by applying the +H (hidden)attribute. -H removes the hidden attribute. The +S (system) and -S options aregenerally used by programmers to hide and unhide command files used only by DOS.After applying the hidden or system attribute to a file, it will not appear in adirectory listing unless you specifically request it with the /A parameter of the DIRECTORY command.

Options

+R - Use the +R option to make a file read-only. Read-only files may be read but they can`t be changed or deleted.

-R - Use the -R option to change the file protection attribute back to normal (so it can be read, changed, or deleted).

+A - Use the +A option to set the ARCHIVE attribute of a file. When the +A option is used, this flags the file as available for archiving when using the BACKUP or XCOPY commands.

-A - Use the -A option to turn off the ARCHIVE attribute.

+H - With DOS Versions 4 through 6, use the +H option to set the HIDDEN attribute of a file so that it will not appear in a directory listing.

-H - Use the -H option to turn off the HIDDEN attribute.

+S - With DOS Versions after Version 4, use the +S option to set the SYSTEM attribute of a file. When the +S option is used, this flags the file as a command file used only by DOS. The file will not appear in a directory listing.This attribute is generally reserved for programmers.

-S - Use the -S option to turn off the SYSTEM attribute.

/S - Use the /S switch to set attributes on subdirectories found within the specified path.

Examples

The following form of the command sets the read-only attribute for the file SALES87.TXT:
SALES87attrib +r a:sales87.txt
SALES87After you have set the read-only attribute for the file SALES87.TXT, DOS will not allow you to delete or modify it (until the attribute is removed).

SALES87To set the archive attribute for the file LETTER3.DOC which is in the \LETTERS directory on drive B, enter

attrib +a b:\letters\letter3.doc

After the archive bit has been set, commands such as XCOPY can selectively act on them (using the BACKUP or XCOPY /M switch). For more information, refer to the BACKUP and XCOPY command sections.
To determine the current attribute settings for all of the files in the current directory, enter

attrib *.*

The attribute settings for all of the files on the current directory will be displayed. If, for example, you were working in the \LETTERS directory on the diskette in drive B, ATTRIB would display something like this:

A B:\LETTERS\LETTER3.TXT
A R B:\LETTERS\SALES87.DOC
B:\LETTERS\SALES-N.TXT

This display indicates that three files were found and that the first two had the archive bit set. The second file is also marked as read-only.

Back to the Easy DOS Command Index


DOS Command: ATTRIB (2024)
Top Articles
10 Things I Learned in My 20s About Investing
How Much Should I Spend on Groceries? (and Stick to the Grocery Budget)
Workday Latech Edu
Jonathon Kinchen Net Worth
What are Dietary Reference Intakes?
Hotels Near 500 W Sunshine St Springfield Mo 65807
Co Parts Mn
Tap Tap Run Coupon Codes
Teamexpress Login
Directions To Lubbock
Www.paystubportal.com/7-11 Login
Moe Gangat Age
Degreeworks Sbu
Reddit Wisconsin Badgers Leaked
Gma Deals And Steals Today 2022
Walmart Windshield Wiper Blades
Available Training - Acadis® Portal
Vermont Craigs List
Video shows two planes collide while taxiing at airport | CNN
DBZ Dokkan Battle Full-Power Tier List [All Cards Ranked]
Lcwc 911 Live Incident List Live Status
Ruben van Bommel: diepgang en doelgerichtheid als wapens, maar (nog) te weinig rendement
Menards Eau Claire Weekly Ad
Amortization Calculator
Vegito Clothes Xenoverse 2
Pasco Telestaff
Weve Got You Surrounded Meme
Account Now Login In
As families searched, a Texas medical school cut up their loved ones
Criglist Miami
Kleinerer: in Sinntal | markt.de
Eegees Gift Card Balance
Progressbook Newark
Christmas Days Away
Prévisions météo Paris à 15 jours - 1er site météo pour l'île-de-France
Rubmaps H
Kattis-Solutions
What Is Xfinity and How Is It Different from Comcast?
Matlab Kruskal Wallis
The Wichita Beacon from Wichita, Kansas
Glossytightsglamour
CVS Near Me | Somersworth, NH
Radical Red Doc
Hingham Police Scanner Wicked Local
Easy Pigs in a Blanket Recipe - Emmandi's Kitchen
Wasmo Link Telegram
Todd Gutner Salary
Mother Cabrini, the First American Saint of the Catholic Church
El Patron Menu Bardstown Ky
Optimal Perks Rs3
Hcs Smartfind
Qvc Com Blogs
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 5943

Rating: 4.2 / 5 (53 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.