Making a File Read-Only

Written by Barry Dysert (last updated May 18, 2020)

Files have several attributes that are used to control how the file is used within Windows. One of the more important ones is known as the "read-only" attribute. When this is set, you can't accidentally edit the file and overwrite it. Why? Because when it is set, Windows understands that the file can only be read or viewed, not modified.

To set the file's read-only attribute, use Windows Explorer (Windows 7) or File Explorer (Windows 8 and Windows 10) to navigate to the file. Once you can see it, right-click the file and then choose Properties from the resulting Context menu. Windows displays the Properties dialog box for the file. (See Figure 1.)

Figure 1. The Properties text box for a file.

Note the Read-Only checkbox, near the bottom of the Properties dialog box. You can set or clear this checkbox according to your desires for the file. When you click OK or Apply, the attribute is changed as you direct.

After the read-only attribute is set, you can try to edit a read-only file, but you will be prevented from saving it. For example, after making my Temp.txt file read-only I opened the file and edited it. When I tried to save the file, I got notification that the operation couldn't be completed because Temp.txt was read-only. (See Figure 2.)

Figure 2. Trying to save a read-only file.

Note that most programs, if they detect that the read-only attribute is set, will allow you to do a "Save As" operation. This means that the file can be saved under a different name, but your original file remains undisturbed.

Marking a file as read-only also affects how you delete files. Most of the time, when you choose to delete a read-only file Windows will dutifully move it to the Recycle Bin. If you choose to empty the Recycle Bin, however, Windows asks you to confirm that you really want to delete the file. (See Figure 3.)

Figure 3. Trying to delete a read-only file.

If you want to really delete the read-only file, click Yes. If you click No (or otherwise close the dialog box), the file is left in the Recycle Bin.

 This tip (12851) applies to Windows 7, 8, and 10.

Author Bio

Barry Dysert

Barry has been a computer professional for over 35 years, working in different positions such as technical team leader, project manager, and software developer. He is currently a software engineer with an emphasis on developing custom applications under Microsoft Windows. When not working with Windows or writing Tips, Barry is an amateur writer. His first non-fiction book is titled "A Chronological Commentary of Revelation." ...

MORE FROM BARRY

Understanding the Search Index

You can utilize Explorer's search utility to find text within files. To make searches fast, Windows maintains a search ...

Discover More

Transferring Pictures from a Camera

Transferring pictures from a camera to your computer may be simpler than you think. This tip describes the process.

Discover More

AutoHotKeys

AutoHotKeys is a great multi-purpose utility that covers the spectrum from allowing you to define shortcut keys for ...

Discover More
More WindowsTips

Opening a File with a Program Other than the Default

Windows determines a program to use with a particular file based on the file's type. If you want to temporarily override ...

Discover More

Moving Files or Folders

A common operation within Windows is to move files and folders from one location to another. Here are the two major ways ...

Discover More

Clearing Items from the Recently Used Documents List

You may wish to clear your Recently Used Documents list or even have them not remembered in the first place. How you ...

Discover More
Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is three less than 8?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


Newest Tips