I'm trying to set a few files to writable, but I'm having an issue. I have tried using:
$file = "path/to/my/file.dat"
$file = Get-Item $file
$file.IsReadOnly = $false
As well as everything listed here:
How to Remove ReadOnly Attribute on File Using PowerShell?
But it still isn't working, at least I don't think it is because when I check the file properties the 'Read-Only' box is still checked:
UPDDATE::
When I run:
$file.isReadOnly
it returns $false
, but the box below is explicitly checked? Are these two different things?
I'm wondering what I'm doing wrong, or how to make it so this file is editable.
This works:
Get-Item -Path "path/to/my/file.dat" |
Set-ItemProperty -Name IsReadOnly -Value $false
You can actually skip the first line:
$file = Get-Item "path/to/my/file.dat"
Set-ItemProperty $file -Name IsReadOnly -Value $false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With