How do I change a file's attribute using Powershell?

后端 未结 6 1687
抹茶落季
抹茶落季 2021-02-05 05:07

I have a Powershell script that copies files from one location to another. Once the copy is complete I want to clear the Archive attribute on the files in the source location t

6条回答
  •  南方客
    南方客 (楼主)
    2021-02-05 05:34

    Mitch's answer works well for most attributes, but will not work for "Compressed." If you want to set the compressed attribute on a folder using PowerShell you have to use the command-line tool compact

    compact /C /S c:\MyDirectory
    

提交回复
热议问题