Categories: Files

Set read-only attribute from command line

We can mark a file as read-only from the command line too. Command for this is given below.

attrib +R  filename

Example:

attrib +R example.doc

The above command will set the read only attribute for the file file.doc and user will not be able to do modifications to the file.

To check if a file has read only attribute set, you can check by running attrib command on the file.

 attrib filename

Example:

D:data> attrib example.doc
A    R       D:dataexample.doc

Recursively set read-only attribute for all files in the directory

attrib /S +R
Srini

View Comments

Share
Published by
Srini

Recent Posts

Add new user account from command line (CMD)

Adding users from command line is much easier than going through the UI. It saves…

4 years ago

Delete directory from command line [Rmdir]

Do you want to delete a directory from Windows command prompt(CMD)? This post explains how…

4 years ago

TaskKill: Kill process from command line (CMD)

We can kill a process from GUI using Task manager. If you want to do…

4 years ago

Kill Chrome from command line

Chrome is definitely the stable browser compared to other ones and it has been my…

4 years ago

Find windows OS version from command line

Windows has multiple command line utilities that can help find the version of the Windows…

4 years ago

How to check if Windows 32 or 64 bit?

There are multiple ways to check whether a Windows computer is running 32-bit OS or…

7 years ago