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.

2 responses to “Find and Unhide all Hidden Files Using PowerShell”

  1. Hello Jay.

    I want to thank you for your short script, it saved my life. I thought had lost all my backup, but it was hidden!
    And with this script i was able to remove the hidden property and make the files visible again.

    Thanks again.
    Best Regards,


  2. Hi, I just add a write-host to show the fullname of the hidden file being mdified.

    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”; Write-Host $_.FullName}

Leave a Reply

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