Short answer:
sp (gc test.txt) IsReadOnly $false
Long answer below
Something is wrong with this.
$file a string[], . , IsReadOnly string[], , , .
, , , , . " " .
Get-Content . :
$filenames = Get-Content test.txt
. , FileInfo, . -Path Set-ItemProperty.
, . , FileInfo . foreach ( ):
$files = (foreach ($name in $filenames) { Get-Item $name })
IsReadOnly:
foreach ($file in $files) {
$file.IsReadOnly = $false
}
. , , , PowerShell. , , . , .
,
Get-Content test.txt | Get-Item | ForEach-Object { $_.IsReadOnly = $false }
. , string s. Get-Item, , , , : ; , . Get-Item FileInfo , false.
, , , . . , Set-ItemProperty . , Set-ItemProperty -Path.
$files = Get-Content test.txt
Set-ItemProperty -Path $files -Name IsReadOnly -Value $false
, Set-ItemProperty -Path . :
Set-ItemProperty -Path (Get-Content test.txt) -Name IsReadOnly -Value $false
Get-Content , PowerShell, .
, , Set-ItemProperty , , :
Set-ItemProperty (Get-Content test.txt) IsReadOnly $false
:
sp (gc test.txt) IsReadOnly $false
$false 0, , 0 $false . , .