How to mark a file as read-only from command line in Windows 10 ?


This content was proof-read by Grammarly. You can Try Grammary for FREE

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>
image

When you check the file properties , you should see that the file is set to read-only mode.

image
Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

%d bloggers like this: