Dealing with Hidden Files

by Jan 1, 2015

PowerShell 3.0 and later

When you use Get-ChildItem to list files, by default, hidden files are excluded.

To include hidden files, use the –Force parameter:

 
PS> Get-ChildItem -Path $home -Force
 

To only list hidden files, use the -Hidden parameter. This parameter was added in PowerShell 3.0:

 
PS> Get-ChildItem -Path $home -Hidden


    Directory: C:\Users\Tobias


Mode                LastWriteTime     Length Name                                                                
----                -------------     ------ ----                                                                
d--h-        08.01.2012     10:38            AppData                                                             
d--hs        08.01.2012     10:38            Application Data                                                    
d--hs        08.01.2012     10:38            Cookies                                                             
d--hs        08.01.2012     10:38            Local Settings                                                      
d--hs        08.01.2012     10:38            My Documents                                                        
d--hs        08.01.2012     10:38            NetHood                                                             
(...)
 

Twitter This Tip! ReTweet this Tip!