دستور attrib

Most file commands in TCC include the /A: switch, which allows you to select files for the command to process based on their attributes. These switches all use the format /A[:][-+]RHSAD. The colon after /A is optional in DIR, FFIND, and SELECT, but is required in all other commands. The characters after the /A: specify which attributes to select, as follows:

 
Most فرماندهىهایى TCC پرونده which کدامى شما که پرونده‌هایى که برای فرماندهى بر نسبتهاى آنها. All اینها تعویضها. روده بزرگ اختیارى و ولی مورد نیاز در فرماندهىهاى دیگرى همه. منشها که follow R H پنهان شده. دستگاه S. Archive. . نسبتهاى تمدید شده در دسترس همچنین پایین بر حجمهایى NTFS هستند.


R Read-only

H Hidden

S System

A Archive

D Directory

 

On NTFS volumes, the extended attributes below are also available.

 

E Encrypted

C Compressed

I Not content-indexed

L Symbolic link or Junction (reparse point)

N Normal (cannot be used for file selection)

O Offline

P Sparse file

T Temporary

 

The N (normal) attribute is not stored on disk. It is dynamically generated by the operating system if none of the other attributes is set. Its use for file selection is not supported in either commands or variable functions.

N عادى نسبت انبار کرده is نمىشود قرص. آن دستگاه عامل (کامپیوتر) به وجود آورده مىشود هیچى از نسبتهاى دیگر مستقر شده نمىشود. Use گزینش پرونده فرماندهىهایى یا وظیفه‌هاى تغییر پذیرى پشتیبانی کرده is نمىشود


 

If no attributes are listed at all (i.e., /A:), the command will process all files, and (where applicable) all subdirectories, including hidden and system files and directories.

No نسبتهایى فهرست شده all فرماندهى all پرونده‌ها را پردازش کرد و به کار بردنی All دفتر راهنماى فرعى پنهان شده و دستگاه پرونده‌هایى و دفتر راهنما.
 

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.

 نسبتهایى مخلوط همه مشخص کرده نسبتهایى که برای پرونده‌اى گزیده. مثلا A:RHS آنها پرونده‌ها all نسبتى تنها را گزید.

If you precede an attribute with a hyphen -, files with that attribute will be excluded. For example, /A:RH-S selects files which have the read-only and hidden attributes set and which do not have the system attribute set.

 

If you precede an attribute with a plus +, files will be selected which have that attribute turned on or off. When multiple attributes are preceded by +, only files which have at least one of these attributes will be selected. For example, /A:+H+S will select files with the hidden or system attribute, or both, but will not select files which have neither attribute set. /A:R+H+S will select files which are read-only, and also have the hidden or system attribute, or both.

شما نسبتى گزیده بود which کدامى آن نسبت گردانده یا. نسبتهاى چندگانه‌اى تنها پرونده‌هایى که یک حد اقل از اینها نسبتها گزیده بود. مثلا A:+H+S پرونده‌هایى پنهان شده گزید یا دستگاه نسبت, یا هردویى ولی پرونده‌هایى که هیچیک نسبت مستقر شده گزید. /A:R+H+S پرونده‌هایى گزید که و پنهان شده همچنین یا دستگاه نسبت, یا هردویى.


 

You can combine the plus sign, hyphen, and unmarked attributes to build a specification as complex as you need.

 شما و نسبتهاى که ویژگىى پیچیده as شما بى نشانى.

Example

 

The (dangerous!) command below will make all hidden, system, and/or read-only files in the default directory visible and writeable, but not modify the attributes of files which are neither hidden nor system nor read-only (thus not reporting files already in the desired state):

خطرناک!) فرماندهى همه پنهان شده ساخت پایین دستگاه, and/or دفتر راهنما پدیدار و writeable ولی نسبتها از پرونده‌هایى را که هیچیک پنهان شده nor دستگاه nor درحال پرونده‌هایى تاحالا بدین گونه گزارش دادن :
 

       attrib /e /p /a:+r+h+s -r -h -s


*********************************************************************************88
Purpose: Change or view file and subdirectory attributes.

 

Format: ATTRIB [/A:[[-+]rhsa] /D /E /I"text" /P /Q /S[n]] [+|-[AHIORST]] [@file] files ...

 

files A file, directory, or list of files or directories to process.

@file A text file containing the names of the files to process, one per line (see @file lists for details).

 

/A:  (Attribute select)
 /P(ause)
 
/D(irectories)
 /Q(uiet)
 
/E (No error messages)
 /S(ubdirectories)
 
/I"text" (match description)
 
 

 

Attribute flags:

Clear
 Set
 Attribute affected
 
-A
 +A
 archive
 
-H
 +H
 hidden
 
-I
 +I
 not content indexed
 
-O
 +O
 offline
 
-R
 +R
 read-only
 
-S
 +S
 system
 
-T
 +T
 temporary
 

 

File Selection

 

Supports attribute switches, extended wildcards, ranges, multiple file names, and include lists. Use wildcards with caution on LFN volumes; see LFN File Searches for details.

 تعویضهایى نسبت و سیاهه‌هایى. عامل غیر قابل پیش بینى caution بر حجمهایى LFN بازرسىهایى برای تفصیلاتیى پرونده LFN.


Usage:

 

Every file and subdirectory has attributes that can be turned on (set) or turned off (cleared):  Archive, Hidden, Not content indexed, Offline, Read-only, System, and Temporary. For details on the meaning of each attribute, see File Attributes.

 Every پرونده و دفتر راهنماى فرعى نسبتهایى آن گردانده مستقر شده یا off Archive فهرست شده دستگاه و گذرا. نسبتهایى پرونده بر معنی از each نسبت.

 

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 [+|-[AHIORST]] part of the format), or 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:

 

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:

 
نسبت اختیارهایى file(s آن اختیارها بر خط فرماندهى ATTRIB را. نمونه که نسبتهاى متفاوتى بر پرونده‌هاى single متفاوتى پایین فرمان بده. آن نسبت را archive all مستقر مىشود.پس و نسبت را archive.COM.:


attrib +a *.txt +s -a test.com

 

When you use ATTRIB on an LFN drive, you must double quote any file names which contain white space or special characters.

 

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.

 

NTFS also supports D (subdirectory), V (volume label), E (encrypted), C (compressed), J or L (junction / symbolic link) and P (sparse file) attributes. These attributes will be displayed by ATTRIB, but cannot be altered; they are designed to be controlled only by Windows.

 

ATTRIB will ignore underlines in the new attribute (the [+|-[ADHIORST]] part of the command). For example, ATTRIB sees these 2 commands as identical:

 

attrib +a filename

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:

 

attrib -arhs file2 & attrib +%@attrib[file1] file2

 

When ATTRIB encounters a +D or ?D in the attribute string it treats it as equivalent to the /D switch, and allows modification of the attributes of a directory. When combined with @ATTRIB, or with ATTRIB's output, both of which return a D to signify a directory, this feature allows you to transfer attributes from one directory to another. For example, to clear the attributes of all files and directories beginning with ABC and then set their attributes to match those of FILE1 (enter this on one line):

 

attrib -arhs abc* & attrib +%@attrib[file1] abc*

 

Options:

 

/A: Select only those files that have the specified attribute(s) set. See Attribute Switches for information on the attributes which can follow /A:. Warning: the colon after /A is not optional.

 

This 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:

 

attrib /a:h -a *

 

Do not use /A: with @file lists. See @file lists for details.

 

/D If you use the /D option, ATTRIB will modify the attributes of directories in addition to files (yes, you can have a hidden directory):

 

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 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, and when recursing through the directory hierarchy, where many directories have no files matching your selection criteria.        .

 

/I"text" Select files by matching text in their descriptions. The text can include wildcards and extended wildcards. The search text must be enclosed in double quotes, and must immediately follow the /I, with no intervening spaces. You can select all filenames that have a description with /I"[?]*", or all filenames that do not have a description with /I"[]". Do not use /I with @file lists. See @file lists for details

 

/P 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 This option turns off ATTRIB's normal screen output. It is most useful in batch files.

 

/S 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. Do not use /S with @file lists; see @file lists for details.

 

If you specify a number after the /S, ATTRIB will limit the subdirectory recursion to that number.  For example, if you have a directory tree "\a\b\c\d\e", /S2 will only affect the "a", "b", and "c" directories.

 


*************************************************************************8
@ATTRIB[filename[,-rhsadecijlopt[,p]]] : If you do not specify any attributes, @ATTRIB returns the attributes of the specified file in the format RHSADECIJNOPT, rather than 0 or 1. If two or more parameters are specified, @ATTRIB returns a 1 if the specified file has the matching attribute(s); otherwise it returns a 0.

 

The basic attributes for FAT volumes are:

 

N Normal (no attributes set)

R Read-only

A Archive

H Hidden

S System

D Directory

 

In addition, NTFS volumes allow display of the following extended attributes:

 

E Encrypted

C Compressed

I Not content-indexed

J Junction or symbolic link

L Junction or symbolic link

N Normal

O Offline

P Sparse file

T Temporary

 

The extended attributes are displayed when @ATTRIB is invoked with a single parameter, but they are suppressed when used for file selection (two or more parameters). To select files based on the extended attributes, see @WATTRIB.

 

Attributes which are not set will be replaced with an underscore. For example, if SECURE.DAT has the read-only, hidden, and archive attributes set, %@ATTRIB[SECURE.DAT] would return RH_A_______. If the file does not exist, @ATTRIB returns an empty string.

 

The attributes (other than N) can be combined (for example %@ATTRIB[MYFILE,HS]). Normally @ATTRIB will only return 1 if all of the attributes match. However, if a final ,p is included (partial match), then @ATTRIB will return 1 if any of the attributes match. For example, %@ATTRIB[MYFILE,HS,p] will return 1 if MYFILE has the hidden, system, or both attributes. Without ,p the function will return 1 only if MYFILE has both attributes.

 

Filename must be in quotes if it contains white space or special characters.

 

See also: Attributes Switches.

 

Examples:

 

echo %@attrib["C:\Program Files\My Program\myfile.exe",rhs,p]

echo Attributes for myfile.exe: %@attrib[myfile.exe]