Reputation: 45878
Where is the setting to "show / hide items" on a particular folder stored?
I looking to be able to change it programmatically, hopefully in Powershell.
Upvotes: 1
Views: 1901
Reputation: 11
I try you're code but this part doesn't work:
Set-ItemProperty -Path $file -Name attributes -Value ((Get-ItemProperty $file).attributes -bxor ([io.fileattributes]::Hidden))
I just replace "hiden" by "normal" and it's work:
Set-ItemProperty -Path $file -Name attributes -Value ([io.fileattributes]::Normal)
Thank you.
Upvotes: 0
Reputation: 72620
So try this :
$file = "c:\temp\t.txt"
# Hidde $file
Set-ItemProperty -Path $file -Name attributes -Value ([io.fileattributes]::Hidden)
# Remove Hidden if set
Set-ItemProperty -Path $file -Name attributes -Value ((Get-ItemProperty $file).attributes -bxor ([io.fileattributes]::Hidden))
Upvotes: 2