PowerShell: Set File Read Only Attribute
Show Read Only Status
Get-ItemProperty -Path "~/xtest.txt" -Name IsReadOnly # IsReadOnly : False # PSPath : Microsoft.PowerShell.Core\FileSystem::C:\Users\xah\xtest.txt # PSParentPath : Microsoft.PowerShell.Core\FileSystem::C:\Users\xah # PSChildName : xtest.txt # PSDrive : C # PSProvider : Microsoft.PowerShell.Core\FileSystem
Set to Read Only
Set-ItemProperty -Path "~/xtest.txt" -Name IsReadOnly -Value $true
Remove Read Only
Set-ItemProperty -Path "~/xtest.txt" -Name IsReadOnly -Value $false
PowerShell. File Properties, Attributes, Permission
- PowerShell: File Properties
- PowerShell: File Attributes
- PowerShell: List All Possible File Attribute Values
- PowerShell: Show a File's Attributes
- PowerShell: Show Hidden Files
- PowerShell: List Files with Specific Attribute
- PowerShell: Set a File's Attributes
- PowerShell: Set File Read Only Attribute
- PowerShell: File Attributes Object Type
- PowerShell: Change File Owner Perm (ACL)