PowerTip: Display Hidden Files by Using PowerShell

PowerTip: Display Hidden Files by Using PowerShell

  • Comments 5
  • Likes

Summary: Learn how to display hidden files by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to display hidden files?

Hey, Scripting Guy! Answer Use the Force parameter for Get-Childitem (or the aliases dirls or gci):

dir -Force -File

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • gci -force | ?{$_.mode -match "h"}

  • @K you are correct. This will in fact filter out only the hidden files. Great catch. Thanks for sharing.

  • As of March 5, 2014, the -file parameter returns an error:

    C:\2014sigcse\GitHubWorkshop\project1 [master +1 ~0 -0 !]> dir -force -file
    Get-ChildItem : A parameter cannot be found that matches parameter name 'file'.
    At line:1 char:17
    + dir -force -file
    + CategoryInfo : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

  • Try ls -h

  • -file and -Directory were added in Version 3