How to Remove ReadOnly Attribute on File Using PowerShell?

后端 未结 6 1304
无人及你
无人及你 2020-12-08 01:50

How can I remove the ReadOnly attribute on a file, using a PowerShell (version 1.0) script?

6条回答
  •  死守一世寂寞
    2020-12-08 02:19

    If you happen to be using the PowerShell Community Extensions:

    PS> Set-Writable test.txt
    PS> dir . -r *.cs | Set-Writable
    # Using alias swr
    PS> dir . -r *.cs | swr
    

    You can do the opposite like so:

    PS> dir . -r *.cs | Set-ReadOnly
    # Using alias sro
    PS> dir . -r *.cs | sro
    

提交回复
热议问题