List Hidden Files

by | July 21,2009

Table of Contents

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

Use the -Force Parameter to Reveal Hidden Files

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

Dir $env:windir -force

Filter to Show Only Hidden Files

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*’ }