網上下載個工程,無奈發現工程裏的文件都是隻讀的,然後打開後修改個代碼就要另存爲,所以百度搜索了一下用命令行批量修改,記錄一下。
網上都是用的 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 | 處理符號鏈接的屬性與符號鏈接的目標 |