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
Discovering the Forex Holy Grail Concept & Strategy
Can a felon own a gun in California?
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
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.