-1

Where is the setting to display or not display hidden items on a particular folder? For example, if the global setting is to show all hidden files, how would I change the Desktop folder, so that the hidden desktop.ini file does not display?

I am looking to be able to change it programmatically, hopefully in Powershell.

Even Mien
  • 657
  • 2
  • 12
  • 19

2 Answers2

1
attrib -s -h

or

attrib +s +h

(Not Powershell, sorry. Kickin' it old skool.)

There's a nice article on Powershell here. Relevant bit:

$file=file.txt
$file.attributes="Hidden"
$file.attributes="Normal"
Katherine Villyard
  • 18,550
  • 4
  • 37
  • 59
1

In Powershell the hidden attribute is stored in the Attributes property of the Directoryinfo type.

To view all items in a directory with their attributes you'd do this:

Get-ChildItem "C:\MyPath" -Force | Select Name, Attributes

The attributes are comma delimited entries that explain certain properties such as "Hidden, Directory" for a hidden folder. You can remove the hidden attribute by doing a regex replacement on the Attributes property for multiple items like so:

Get-ChildItem "C:\MyPath" -Force |? {$_.Attributes -like "*hidden*"} |% {$_.Attributes = $_.Attributes -replace ", Hidden|Hidden,? ?", ""}
James Santiago
  • 876
  • 5
  • 11