How To Make A File Read-Only In Windows

Print Page

Here’s a quick tip if you have a file that you may not want anyone to change the contents or modify. In other words make the file read only.

Now this is not something that will completely prevent someone from changing the contents of the file, but I find it to be useful, more like a reminder) in situations where I want to prevent myself from changing the file accidentally.

After you have created the file (it can by any kind of file with any kind of extension), just right click on the file and select Properties.

In the Properties window, towards the bottom, click on the check box next to Read-only then click on OK to save the setting.

When you do try to save the file after making changes, you will see the following error message:

To not save the file, click OK (for the error message), then close the file and select Don’t Save.

With the Read-only attribute set, any changes to the file will be prevented until you un-check the setting for the file.

Using The Command Prompt:

If you prefer to use the command line to set the Read-only attribute, use the following command at the prompt: attrib +r filename

To reset the Read-only attribute (remove it and make the file writable again), use the following command at the prompt: attrib -r filename

Remember to replace filename with the actual name of the file.

Once you have set the Read-only attribute, it will remain even when you copy the file to another location on your computer or to another Windows computer.

Remember, this method is not a substitute for any kind of security, but is a nice solution…when you want to prevent yourself from modifying files that you don’t want changed.