Executing ala chmod / attrib permissions with Powershell

I would like to make an equivalent chmod -w+r-x fooeither attrib +R fooin Windows Powershell. While cheating, I notice a pretty gnarly Set-Aclfunction that looks significantly more interesting than what I need.

How to do attrib +R fooin Windows Powershell?

+5
source share
1 answer

Community Extensions PowerShell comes with Set-Writable (with the alias swr) and Set-ReadOnly (aliased to sro). I use them as often. Removing execution rights requires a change in ACLs, but using Get-Acl / Set-Acl is painful. I would use icacls.exe.

, - , readonly true/false :

Set-ItemProperty foo.txt IsReadOnly $true # or $false
+9

All Articles