网上下载个工程,无奈发现工程里的文件都是只读的,然后打开后修改个代码就要另存为,所以百度搜索了一下用命令行批量修改,记录一下。
网上都是用的 attrib .\*.* -r /s这个,试用了一下,正还可以解决我的问题,介绍一下这个指令。
如果文件已经打开,不想关闭后执行,再重新打开,可以使用 attrib .\*.* -r /s /d
官方给出的help如下:
λ attrib /?
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [+O | -O] [+I | -I] [+P | -P] [+U | -U]
[drive:][path][filename] [/S [/D]] [/L]
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
O Offline attribute.
I Not content indexed file attribute.
X No scrub file attribute.
V Integrity attribute.
P Pinned attribute.
U Unpinned 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.
/L Work on the attributes of the Symbolic Link versus
the target of the Symbolic Linkj
简单翻译一下:
+ | 添加一种属性 | - | q清除一种属性 |
R | 只读属性 | A | 可以存档文件 |
S | 系统文件 | H | 隐藏文件 |
O | 离线 | I | 不允许文件内容索引 |
X | No scrub file attribute | V | Integrity attribute |
P | Pinned attribute | U | Unpinned attribute |
[drive:][path][filename]
| 指定文件[驱动器][路径][文件名] | /S | 处理当前文件夹中的文件和所有子文件夹 |
/D | c处理载入进程的文件夹? | /L | 处理符号链接的属性与符号链接的目标 |