Published: April 17, 2012
发布:2012.4.17
Updated: April 17, 2012
更新:2012.4.17
Displays, sets, or removes attributes assigned to files or directories. If used without parameters, attrib displays attributes of all files in the current directory.
显示、设置、或移除分配给文件或目录的属性。如果不是用参数,attrib显示所有在当前目录下文件的属性。
For examples of how to use this command, see Examples.
例如如何使用这个命令,看例子
Syntax
语法
________________________________________
attrib [{+|-}r] [{+|-}a] [{+|-}s] [{+|-}h] [{+|-}i] [<Drive>:][<Path>][<FileName>] [/s [/d] [/l]]
Parameters
参数
________________________________________
Parameter Description
{+|-}r Sets (+) or clears (-) the Read-only file attribute.
设置(+)或清除(-)文件的只读属性。
{+|-}a Sets (+) or clears (-) the Archive file attribute.
设置(+)或清除(-)文件的存档属性。
{+|-}s Sets (+) or clears (-) the System file attribute.
设置(+)或清除(-)文件的系统属性。
{+|-}h Sets (+) or clears (-) the Hidden file attribute.
设置(+)或清除(-)文件的隐藏属性。
{+|-}i Sets (+) or clears (-) the Not Content Indexed file attribute.
设置(+)或清除(-)无内容索引文件属性
[<Drive>:]
[<Path>]
[<FileName>] Specifies the location and name of the directory, file,
or group of files for which you want to display or change attributes.
You can use the ? and * wildcard characters in the FileName parameter to display or change the attributes for a group of files
指定目录,文件,或一组你想要显示或改变属性的文件的位置.你可以使用?和*通配符在文件名字参数中来显示或者改变一组文件的属性。
/s Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories.
将attrib和该命令的选项应用于匹配的当前目录和所有子目录。
/d Applies attrib and any command-line options to directories.
将attrib和该命令的选项应用于目录文件夹。
/l Applies attrib and any command-line options to the Symbolic Link, rather than the target of the Symbolic Link.
将attrib和该命令的选项应用于
/? Displays help at the command prompt.
在命令行提示中显示帮助信息。
Remarks
备注
________________________________________
• You can use wildcard characters (? and *) with the FileName parameter to display or change the attributes for a group of files.
你可以在文件名参数中使用通配符来显示或者改变一组文件的属性。
• If a file has the System (s) or Hidden (h) attribute set, you must clear the attribute before you can change any other attributes for that file.
如果一个文件有系统或隐藏属性设置,在你改变那个文件其他属性之前你必须清除那个文件的系统和隐藏属性。
• The Archive attribute (a) marks files that have changed since the last time they were backed up. Note that the xcopycommand uses archive attributes.
存档属性标记最近一次备份之后改变过的文件。注意xcopy命令使用存档属性。
To display the attributes of a file named News86 that is located in the current directory, type:
为了显示位于当前目录中的文件名为News86文件的属性,输入:
attrib news86
To assign the Read-only attribute to the file named Report.txt, type:
为了给名字叫Report.txt的文件标记只读属性,输入:
attrib +r report.txt
To remove the Read-only attribute from files in the Public directory and its subdirectories on a disk in drive B, type:
为了给磁盘中B驱动器上的 Public目录中的文件和他的子目录移除只读属性,输入:
attrib -r b:\public\*.* /s
To set the Archive attribute for all files on drive A, and then clear the Archive attribute for files with the .bak extension, type:
为了给A驱动器除了.bak为扩展名的所有文件设置存档属性,输入:
attrib +a a:*.* & attrib -a a:*.bak