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
3 Easy Steps to Install Third-Party Apps in Samsung Smart TV
24 Fulfilling Jobs for Introverts Based on Skill
Golden Abyss - Chapter 5 - Lunar_Angel
Durr Burger Inflatable
Davita Internet
Myhr North Memorial
Emmalangevin Fanhouse Leak
How to Type German letters ä, ö, ü and the ß on your Keyboard
Weather In Moon Township 10 Days
Jessica Renee Johnson Update 2023
The Weather Channel Facebook
Jack Daniels Pop Tarts
Wisconsin Women's Volleyball Team Leaked Pictures
Espn Horse Racing Results
Itziar Atienza Bikini
Weather Rotterdam - Detailed bulletin - Free 15-day Marine forecasts - METEO CONSULT MARINE
Vigoro Mulch Safe For Dogs
How to Grow and Care for Four O'Clock Plants
Japanese Mushrooms: 10 Popular Varieties and Simple Recipes - Japan Travel Guide MATCHA
Imouto Wa Gal Kawaii - Episode 2
Atlases, Cartography, Asia (Collection Dr. Dupuis), Arch…
Play It Again Sports Norman Photos
Pawn Shop Moline Il
Miles City Montana Craigslist
Pokémon Unbound Starters
Astro Seek Asteroid Chart
Busch Gardens Wait Times
James Ingram | Biography, Songs, Hits, & Cause of Death
Matlab Kruskal Wallis
Σινεμά - Τι Ταινίες Παίζουν οι Κινηματογράφοι Σήμερα - Πρόγραμμα 2024 | iathens.gr
No Hard Feelings Showtimes Near Tilton Square Theatre
Consume Oakbrook Terrace Menu
Chilangos Hillsborough Nj
Indiefoxx Deepfake
Avance Primary Care Morrisville
Studentvue Columbia Heights
“Los nuevos desafíos socioculturales” Identidad, Educación, Mujeres Científicas, Política y Sustentabilidad
Pepsi Collaboration
Sam's Club Gas Prices Florence Sc
10 Rarest and Most Valuable Milk Glass Pieces: Value Guide
The power of the NFL, its data, and the shift to CTV
LoL Lore: Die Story von Caitlyn, dem Sheriff von Piltover
Garland County Mugshots Today
Lyons Hr Prism Login
Spreading Unverified Info Crossword Clue
Sam's Club Gas Price Sioux City
Star Sessions Snapcamz
The Jazz Scene: Queen Clarinet: Interview with Doreen Ketchens – International Clarinet Association
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.