ATTRIB - Change or view file attributes
Purpose: Change or view file and subdirectory attributes.
Format: ATTRIB [/A:[[-]rhsda] /D /E /P /Q /S] [+|-[AHRS]] file ...
file : A file, directory, or list of files or directories on
which to operate.
/A: (Attribute select) /P(ause)
/D(irectories) /Q(uiet)
/E (No error messages) /S(ubdirectories)
Attribute flags:
+A Set the archive attribute
-A Clear the archive attribute
+H Set the hidden attribute
-H Clear the hidden attribute
+R Set the read-only attribute
-R Clear the read-only attribute
+S Set the system attribute
-S Clear the system attribute
File Selection
Supports extended wildcards, ranges, multiple file names, and include
lists.
Usage
Every file and subdirectory has 4 attributes that can be turned on (set)
or turned off (cleared): Archive, Hidden, Read- only, and System.
The ATTRIB command lets you view, set, or clear attributes for any file,
group of files, or subdirectory. You can view file attributes by
entering ATTRIB without specifying new attributes (i.e., without the
[+|-[AHRS]] part of the format), or with the DIR /T command.
You can view file attributes by entering ATTRIB without specifying new
attributes (i.e., without the [+|-[AHRS]] part of the format). (You can
also view file attributes with the DIR /T command.)
The primary use of ATTRIB is to set attributes. For example, you can set
the read-only and hidden attributes for the file MEMO:
[c:\] attrib +rh memo
Attribute options apply to the file(s) that follow the options on the
ATTRIB command line. The example below shows how to set different
attributes on different files with a single command. It sets the archive
attribute for all .TXT files, then sets the system attribute and clears
the archive attribute for TEST.COM :
[c:\] attrib +a *.txt +s -a test.com
When you use ATTRIB on an HPFS drive, you must quote any file names which
contain whitespace or special characters. See File Names for additional
details.
To change directory attributes, use the /D switch. If you give ATTRIB a
directory name instead of a file name, and omit /D, it will append "\*.*"
to the end of the name and act on all files in that directory, rather
than acting on the directory itself.
Your operating system also supports "D" (subdirectory) and "V" (volume
label) attributes. These attributes cannot be altered with ATTRIB; they
are designed to be controlled only by the operating system itself.
ATTRIB will ignore underlines in the new attribute (the [+|-[AHRS]] part
of the command). For example, ATTRIB sees these two commands as
identical:
[c:\] attrib +a filename
[c:\] attrib +__A_ filename
This allows you to use a string of attributes from either the @ATTRIB
variable function or from ATTRIB itself (both of which use underscores to
represent attributes that are not set) and send that string back to
ATTRIB to set attributes for other files. For example, to clear the
attributes of FILE2 and then set its attributes to match those of FILE1
(enter this on one line):
[c:\] attrib -arhs file2 & attrib +%@attrib[file1] file2
Options
/A:: (Attribute select) Select only those files that have the
specified attribute(s) set. Preceding the attribute character
with a hyphen [-] will select files that do not have that
attribute set. The colon [:] after /A is required. The
attributes are:
R Read-only
H Hidden
S System
D Subdirectory
A Archive
If no attributes are listed at all (e.g., ATTRIB /A: ...), ATTRIB will
select all files and subdirectories including hidden and system files.
If attributes are combined, all the specified attributes must match for
a file to be selected. For example, /A:RHS will select only those files
with all three attributes set.
The /A: switch specifies which files to select, not which attributes to
set. For example, to remove the archive attribute from all hidden files,
you could use this command:
[c:\] attrib /a:h -a *.*
/D:(Directories) If you use the /D option, ATTRIB will modify the
attributes of subdirectories in addition to files (yes, you can have a
hidden subdirectory):
[c:\] attrib /d +h c:\mydir
If you use a directory name instead of a file name, and omit /D, ATTRIB
will append "\*.*" to the end of the name and act on all files in that
directory, rather than acting on the directory itself. /E:(No error
messages) Suppress all non-fatal error messages, such as "File Not
Found." Fatal error messages, such as "Drive not ready," will still be
displayed. This option is most useful in batch files and aliases.
/P:(Pause) Wait for a key to be pressed after each screen page before
continuing the display. Your options at the prompt are explained in
detail under Page and File Prompts. /Q:(Quiet) This option turns off
ATTRIB's normal screen output. It is most useful in batch files.
/S:(Subdirectories) If you use the /S option, the ATTRIB command will be
applied to all matching files in the current or named directory and all
of its subdirectories.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs