Even Mien
Even Mien

Reputation: 45878

Change the Show Hidden Items setting on a folder

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

Answers (2)

Murphy BZH
Murphy BZH

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

JPBlanc
JPBlanc

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

Related Questions