How to Change the Read-Only Attribute for Files on Windows

When a file is marked as read-only on Windows, you can only view it and not change it in any way. This essentially protects important files from unauthorized changes.

On Windows, you’re able to set or remove the read-only attribute for a file by modifying its properties. Alternatively, you can also run a command in Command Prompt or Windows PowerShell to do the same. In this article, we take a look at all of them.

4

1. How to Change the Read-Only Attribute for Files by Modifying Properties

The easiest way to set or remove the read-only attribute for a file on Windows is by modifying its properties. Here’s how you may go about it.

Note that Windows may prevent you from changing the read-only attribute of a file if you don’t have the necessary permissions to modify the folder in which the file is located. In that case, you must take ownership of the folder first. If you need help, check our guide onhow to take ownership of folders on Windows.

How to Change the Read-Only Attribute for Files on Windows

2. How to Change the Read-Only Attribute for Files Using the Command Prompt

Command Prompt is one of two command-line tools available on Windows. you could use it to run batch files, troubleshoot errors, and perform various other tasks. It also lets you change a file’s read-only attribute with a single command. Here are the steps you need to follow.

ReplaceFilePathin the above command with the actual path of the file copied earlier.

Change Read-Only Attribute by Modifying Properties

Once you run the above command, the file will be set as read-only. Likewise, if you want to remove the read-only attribute for a file, use this command:

Once you remove the read-only attribute for a file, you should be able to edit or modify it.

Change Read-Only Attribute With Command Prompt

Like using Command Prompt? Check our guide to learnhow to master Command Prompt on Windows.

3. How to Change the Read-Only Attribute for Files Using Windows PowerShell

You can also run a command inWindows PowerShellto change the read-only attribute for a file.

To change the read-only attribute using PowerShell:

Change Read-Only Attribute With PowerShell

Alternatively, if you want to remove the read-only attribute for a file, use this command:

Modifying the Read-Only Attribute for Files on Windows

It’s worth noting that most system files on Windows will have the read-only attribute by default. So, make sure you don’t modify them by mistake. For your other files, you can pick any of the above methods listed above to set or unset their read-only attribute.

Windows folders will sometimes lock you out of themselves, but fortunately, it’s an easy fix.

My foolproof plan is to use Windows 10 until 2030, with the latest security updates.

Not Linux, not Windows. Something better.

Some subscriptions are worth the recurring cost, but not these ones.

Obsidian finally feels complete.

The best features aren’t the ones being advertised.

Technology Explained

PC & Mobile