Windows命令行修改文件属性

    网上下载个工程,无奈发现工程里的文件都是只读的,然后打开后修改个代码就要另存为,所以百度搜索了一下用命令行批量修改,记录一下。

    网上都是用的 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不允许文件内容索引
XNo scrub file attributeVIntegrity attribute
PPinned attributeUUnpinned attribute

[drive:][path][filename]
指定文件[驱动器][路径][文件名]/S处理当前文件夹中的文件和所有子文件夹
/Dc处理载入进程的文件夹?/L处理符号链接的属性与符号链接的目标
    不太会翻译,有用到的以后再修改吧。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章