You can set a file to a read-only mode from the command line by using the command attrib and passing in the parameters like the read-only mode and the name of the file.
The format of this command is as follows
attrib +R <Name of the the file>
How to mark a file as read-only from command line in Windows 10 ?
For example , assume that the name of the file is abundantcode.docx and you want to set the read-only attribute for this file that is stored in the D drive , you will enter the following command in the command prompt.
C:\Users>attrib +R d:\abundantcode.docx C:\Users>
When you check the file properties , you should see that the file is set to read-only mode.
Leave a Reply