Command line 在MS-DOS中更改一组文件的属性
MS-DOS命令Command line 在MS-DOS中更改一组文件的属性,command-line,batch-file,dos,Command Line,Batch File,Dos,MS-DOS命令attrib更改单个文件的属性。如何使用它来更改一组文件的属性?这是您需要的信息 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
attrib
更改单个文件的属性。如何使用它来更改一组文件的属性?这是您需要的信息
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.
显示或更改文件属性。
属性[+R |-R][+A |-A][+S |-S][+H |-H][drive:[path][filename]
[S[/D]]
+设置属性。
-清除属性。
R只读文件属性。
存档文件属性。
S系统文件属性。
H隐藏文件属性。
[驱动器:][path][filename]
指定attrib要处理的一个或多个文件。
/S处理当前文件夹中的匹配文件
和所有子文件夹。
/D也处理文件夹。
例如,通过使用“/s”参数,可以对匹配的文件执行此操作
attrib -rhsa *.txt /s
属性-rhsa*.txt/s
这将从所有以“.txt”结尾的文件中删除读取、隐藏、系统和存档属性。我相信它将使用通配符。例如: attrib+r*--设置所有具有该属性的文件 或 attrib+r*.doc——使用该属性设置以.doc结尾的文件 或者类似的东西,随便哪个适合你的需要。但是,如果结果中有隐藏文件,则不会更新这些文件。至少它们不在我的电脑上
编辑:对可以设置的其他属性使用上一个答案。我只列出了一个例子,而不是一个完整的列表。www.computerhope.com是一个很好的dos命令站点。这组文件在哪里 您可以使用
FOR
命令以获得更大的灵活性:
FOR /R "[directory]" %%f IN ([filetype]) DO (
attrib [opts] "%%f"
)
其中,
[directory]
是一个目录(如%CD%
或C:\Users\me\Desktop
),[filetype]
是一个过滤器(如*.txt
或log?.log
)和[opts]
是您将用来调用属性的选项集?或者实际上是Windows?