> DOS 中文参考手册 > attrib

ATTRIB

(attrib)


显示或更改文件属性。

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [[drive:] [path] filename] [/S [/D]]

+ 设置属性。

- 清除属性。

R 只读文件属性。

A 存档文件属性。

S 系统文件属性。

H 隐藏文件属性。

[drive:][path][filename] 指定要处理的文件属性。

/S 处理当前文件夹及其子文件夹中的匹配文件。

/D 也处理文件夹。

★★★★★实例★★★★★:

下列命令,显示当前驱动器上名为NEWS86的文件属性:

attrib news86

下列命令,将只读属性赋给文件REPORT.TXT:

attrib +r report.txt

下列命令,从存在B盘上目录\PUBLIC\JONES及其子目录下的文件的文件属性中删去只读属性:

attrib -r b:\public\jones\*.* /s

作为最后一个例子,假设您想操作A盘的默认目录下的所有文件(.BAK文件除外)。因为要用<XCOPY>拷贝那些标以归档属性的文件,故需对您想拷贝的文件设置归档属性。这可用下面的两条命令办到,它先为A驱的所有文件设置归档属性,再删去那些带.BAK扩展名的文件的归档属性:

attrib +a a:*.*

attrib -a a:*.bak


Displays or changes file attributes.

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename]

[/S [/D]]

+ Sets an attribute.

- Clears an attribute.

R Read-only file attribute.

A Archive file attribute.

S System file attribute.

H Hidden file attribute.

[drive:][path][filename]

Specifies a file or files for attrib to process.

/S Processes matching files in the current folder

and all subfolders.

/D Processes folders as well.


下一篇: