Find and Unhide all Hidden Files Using PowerShell

This PowerShell one-liner will find all hidden files and folders in the current directory and turn off the Hidden attribute:

Get-ChildItem -Force -Recurse | Where-Object{($_.Attributes.ToString().Split(“, “) -contains “Hidden”) -and ($_.Name -ne “thumbs.db”) -and ($_.Name -notlike “~*”) -and ($_.Name -ne “desktop.ini”) -and ($_.Name -ne “folder.ico”)} | foreach {$_.Attributes = “Archive”}

I deliberately wrote this to skip thumbs.db, desktop.ini, folder.ico and Microsoft Office temporary files, because there are very few scenarios in which I would want to unhide those. If you want to include them, just remove that qualifier from the Where-Object statement.

Leave a Reply

Your email address will not be published. Required fields are marked *