List Hidden Files

Did you notice that Dir, ls or Get-ChildItem do not return hidden files?

To see hidden files, you need to specify the -force parameter:

Dir $env:windir -force

But what if you just wanted to see hidden files only? Filter the result, for example like this:

Dir $env:windir -force | Where-Object { $_.Mode -like '*h*' }

Posted Jul 21 2009, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.