PowerShell: Remove readonly attribute
May 1, 2009
Leave a comment
To remove a file READONLY attribute from a file using powershell the following command does the job:
attrib -h -r -s drive:\<path>\<foldername>
* note:you need to first remove the hidden attributes otherwise you will recieve the following error: “Not resetting hidden file.”
To further extend, you can view file attributes using:
attrib drive:\<path>\<foldername>
and make the file readonly using:
attrib +r drive:\<path>\<foldername>
and make the file both hidden and readonly using
attrib +h +r drive:\<path>\<foldername>
Reference: http://support.microsoft.com/kb/326549