Published by
Administrator
|
|
How to Set or Unset Read-only Attribute of Files and Folders in Windows 10

Information
In Windows, you can set or unset the read-only
attribute for files and folders to give files write protection.
Folders cannot actual be set as read-only though. Only files in the folder will be set as read-only instead.
When a file (ex: text file) is set as read-only, the file can no longer be altered since it no longer allows write permission. You will still be able to save your changes to the file as a new file though.
This tutorial will show you different ways on how to set or unset the
read-only attribute of files and folders in
Windows 10.

Note
Read-only box = Neutral setting of a folder that is always displayed by default.
Read-only box = File is currently read-only. Only displays temporarily for a folder while setting to be applied to files in folder.
Read-only box = File is currently not read-only. Only displays temporarily for a folder while setting to be applied to files in folder.
CONTENTS:
- Option One: To Set Read-only Attribute of Files and Folders from Properties
- Option Two: To Unset Read-only Attribute of Files and Folders from Properties
- Option Three: To Set Read-only Attribute of File using Command Prompt
- Option Four: To Unset Read-only Attribute of File using Command Prompt
- Option Five: To Set Read-only Attribute of All Files in Folder and Subfolders using Command Prompt
- Option Six: To Unset Read-only Attribute of All Files in Folder and Subfolders using Command Prompt
- Option Seven: To Set Read-only Attribute of File using PowerShell
- Option Eight: To Unset Read-only Attribute of File using PowerShell
- Option Nine: To Set Read-only Attribute of All Files in Folder and Subfolders using PowerShell
- Option Ten: To Unset Read-only Attribute of All Files in Folder and Subfolders using PowerShell
EXAMPLE: File is set to read-only message


OPTION ONE

To Set Read-only Attribute of Files and Folders from Properties
1. Open File Explorer (Win+E).
2. Select one or more files and/or folders you want to set as read-only, right click or press and hold on the selected items, and click/tap on
Properties. (see screenshot below)
3. In the
General tab, check the
Read-only box in the bottom
Attributes section, and click/tap on
OK. (see screenshots below)
4. If you selected a folder, select (dot) to either
Apply changes to this folder only or
Apply changes to this folder, subfolders and files for what you want, and click/tap on
OK. (see screenshots below)

Note
Apply changes to this folder only will only not be grayed out if you selected other files or folders in addition with this folder.
If you select (dot) Apply changes to this folder only, any selected folders and their contents will be ignored.

OPTION TWO

To Unset Read-only Attribute of Files and Folders from Properties
1. Open File Explorer (Win+E).
2. Select one or more files and/or folders you want to unset as read-only, right click or press and hold on the selected items, and click/tap on
Properties. (see screenshot below)
3. In the
General tab, uncheck the
Read-only box in the bottom
Attributes section, and click/tap on
OK. (see screenshots below)
4. If you selected a folder, select (dot) to either
Apply changes to this folder only or
Apply changes to this folder, subfolders and files for what you want, and click/tap on
OK. (see screenshots below)

Note
Apply changes to this folder only will only not be grayed out if you selected other files or folders in addition with this folder.
If you select (dot) Apply changes to this folder only, any selected folders and their contents will be ignored.

OPTION THREE

To Set Read-only Attribute of File using Command Prompt
1. Open a
command prompt or
elevated command prompt based based on the access permissions you have for the file.
2. Type the command below into the command prompt, and press
Enter. (see screenshot below)
attrib +r "full path of file with extension"

Note
Substitute full path of file with extension in the command above with the actual full path of the file you want to set as read-only.
For example: attrib +r "C:\Users\Brink\Desktop\Folder\File1.txt"


OPTION FOUR

To Unset Read-only Attribute of File using Command Prompt
1. Open a
command prompt or
elevated command prompt based based on the access
permissions you have for the file.
2. Type the command below into the command prompt, and press
Enter. (see screenshot below)
attrib -r "full path of file with extension"

Note
Substitute full path of file with extension in the command above with the actual full path of the file you want to unset as read-only.
For example: attrib -r "C:\Users\Brink\Desktop\Folder\File1.txt"


OPTION FIVE

To Set Read-only Attribute of All Files in Folder and Subfolders using Command Prompt
1. Open a
command prompt or
elevated command prompt based based on the access
permissions you have for the folder.
2. Type the command below into the command prompt, and press
Enter. (see screenshot below)
attrib +r "full path of folder\*" /s /d

Note
Substitute full path of folder in the command above with the actual full path of the folder you want to set read-only for all files in this folder and its subfolders.
For example: attrib +r "C:\Users\Brink\Desktop\Folder\*" /s /d


OPTION SIX

To Unset Read-only Attribute of All Files in Folder and Subfolders using Command Prompt
1. Open a
command prompt or
elevated command prompt based based on the access
permissions you have for the folder.
2. Type the command below into the command prompt, and press
Enter. (see screenshot below)
attrib -r "full path of folder\*" /s /d

Note
Substitute full path of folder in the command above with the actual full path of the folder you want to unset read-only for all files in this folder and its subfolders.
For example: attrib -r "C:\Users\Brink\Desktop\Folder\*" /s /d


OPTION SEVEN

To Set Read-only Attribute of File using PowerShell

Note
1. Open
PowerShell or
elevated PowerShell based on the access permissions you have for the file.
2. Type the command below into PowerShell, and press
Enter. (see screenshot below)
Set-ItemProperty -Path "full path of file with extension" -Name IsReadOnly -Value $True

Note
Substitute full path of file with extension in the command above with the actual full path of the file you want to set as read-only.
For example: Set-ItemProperty -Path "C:\Users\Brink\Desktop\Folder\File1.txt" -Name IsReadOnly -Value $True


OPTION EIGHT

To Unset Read-only Attribute of File using PowerShell

Note
1. Open
PowerShell or
elevated PowerShell based on the access permissions you have for the file.
2. Type the command below into PowerShell, and press
Enter. (see screenshot below)
Set-ItemProperty -Path "full path of file with extension" -Name IsReadOnly -Value $False

Note
Substitute full path of file with extension in the command above with the actual full path of the file you want to unset as read-only.
For example: Set-ItemProperty -Path "C:\Users\Brink\Desktop\Folder\File1.txt" -Name IsReadOnly -Value $False


OPTION NINE

To Set Read-only Attribute of All Files in Folder and Subfolders using PowerShell

Note
1. Open
PowerShell or
elevated PowerShell based on the access permissions you have for the folder.
2. Type the command below into PowerShell, and press
Enter. (see screenshot below)
Get-ChildItem -Path "full path of file with extension" -Recurse -File | % { $_.IsReadOnly=$True }

Note
Substitute full path of file with extension in the command above with the actual full path of the folder you want to set read-only for all files in this folder and its subfolders.
For example: Get-ChildItem -Path "C:\Users\Brink\Desktop\Folder\File1.txt" -Recurse -File | % { $_.IsReadOnly=$True }


OPTION TEN

To Unset Read-only Attribute of All Files in Folder and Subfolders using PowerShell

Note
1. Open
PowerShell or
elevated PowerShell based on the access permissions you have for the folder.
2. Type the command below into PowerShell, and press
Enter. (see screenshot below)
Get-ChildItem -Path "full path of file with extension" -Recurse -File | % { $_.IsReadOnly=$False }

Note
Substitute full path of file with extension in the command above with the actual full path of the folder you want to unset read-only for all files in this folder and its subfolders.
For example: Get-ChildItem -Path "C:\Users\Brink\Desktop\Folder\File1.txt" -Recurse -File | % { $_.IsReadOnly=$False }

That's it,
Shawn