Windows – How to remove read-only attribute recursively on Windows

batchcommand linefile-attributeswindows

I need to remove read-only attributes of all files under a directory recursively on Windows using command line. Could you please provide an example on this?

Best Answer

I would use the ATTRIB command, for example:

attrib -r c:\folder\*.* /s

attrib is the command
-r is the flag for removing read-only attributes
c:\folder\*.* is the folder you are running it on, plus wildcards for all files
/s is the flag for doing all sub directories and files

Here is some more documentation and examples for the attrib command: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/attrib