How to List Hidden Files in PowerShell?

Do you want to find hidden files on your Windows workstation—maybe in your C:\Users\Public\Documents or a project folder in C:\Projects\USA? PowerShell offers several commands to locate hidden files.

In this tutorial, I’ll show you step-by-step how to list hidden files using PowerShell using different methods.

Hidden files are often system files or configuration files that Windows or applications don’t want you to modify accidentally.

Below are a few methods to list hidden files in PowerShell.

Method 1: List Hidden Files Using Get-ChildItem with the -Hidden Parameter

The Get-ChildItem cmdlet (also accessible via gci, ls, or dir) is the core PowerShell command for listing files and directories. By adding the -Hidden parameter, you can filter out and display only hidden files.

Example:

Suppose you want to list all hidden files in C:\Users\Public\Documents.

Get-ChildItem -Path "C:\Users\Public\Documents" -Hidden

This command scans the specified directory and returns only those files and folders marked as hidden. It’s a straightforward way to quickly audit hidden items in any folder.

Why does this work? The -Hidden parameter tells PowerShell to include only items with the hidden attribute, making it ideal for focused searches in directories with lots of files.

Check out Find Files Modified After a Specific Date Using PowerShell

Method 2: Reveal All Files (Including Hidden and System) with -Force

Sometimes, you want to see everything in a directory—hidden files, system files, and regular files. The -Force parameter with Get-ChildItem is your best friend for this scenario.

Example:
List all files, including hidden and system files, in C:\Projects\USA.

Get-ChildItem -Path "C:\Projects\USA" -Force

By using -Force, PowerShell ignores the usual restrictions and displays all items, even those typically hidden from view. This method is especially useful for comprehensive audits and troubleshooting.

Why does this work? The -Force parameter overrides PowerShell’s default behavior, ensuring you never miss a file—critical when you’re dealing with sensitive or complex directories.

Read Get Files Older Than 1 Month with PowerShell

Method 3: Filter Hidden Files by Type or Name

Sometimes, you want to narrow your search to specific file types (like .log or .config) or names. You can combine -Hidden or -Force with the -Filter or -Include parameters.

Example:
Find all hidden .config files in C:\inetpub\wwwroot.

Get-ChildItem -Path "C:\inetpub\wwwroot" -Hidden -Filter *.config

This command is perfect for developers or admins working with web servers or application directories, helping you spot hidden configuration files quickly.

Why does this work? Combining filters with the -Hidden parameter lets you zero in on exactly what you need, reducing noise and saving time during audits or troubleshooting.

Check out PowerShell Script to Delete Files Older Than 30 Days

Method 4: Recursively List Hidden Files in Subfolders

In real-world scenarios, hidden files are often buried deep within nested folders. The -Recurse parameter helps you search through all subdirectories.

Example:
Recursively list all hidden files in D:\Data\USA_Archives.

Get-ChildItem -Path "D:\Data\USA_Archives" -Hidden -Recurse

This approach is invaluable for forensic investigations, compliance checks, or when you inherit a large, unfamiliar directory structure.

Why does this work? The -Recurse flag tells PowerShell to traverse every subdirectory, ensuring no hidden file escapes your audit.

List Hidden Files in PowerShell

Method 5: Display Hidden Files with Detailed Information

For deeper analysis, you may want to see file attributes, sizes, or timestamps. By piping the output to Select-Object, you can customize the displayed details.

Example:
Show hidden files with their full path, size, and last modified date.

Get-ChildItem -Path "C:\Finance\USA_Reports" -Hidden | 
Select-Object FullName, Length, LastWriteTime

This method is ideal for generating reports or documentation for compliance or asset management.

Why does this work? Select-Object lets you tailor the output, making it easier to spot anomalies or gather information for further action.

Check out Check Who Modified a File Last in Windows Using PowerShell

Method 6: List Hidden Files Owned by a Specific User

In enterprise environments, you may want to find hidden files owned by a particular user (for example, jane.smith). You can use Where-Object in combination with Get-ChildItem.

Example:
Find hidden files in C:\Users owned by jane.smith.

Get-ChildItem -Path "C:\Users" -Hidden -Recurse |
Where-Object { $_.GetAccessControl().Owner -like "*jane.smith*" }

This is especially useful for security audits or when offboarding employees.

Why does this work? By filtering based on file ownership, you can quickly identify files that may need to be archived, deleted, or further investigated.

Check out Find Files Modified in the Last 24 Hours in PowerShell

Quick Reference Table

MethodCommand ExampleWhen to Use
List only hidden filesGet-ChildItem -HiddenQuick audits for hidden files
Show all (hidden/system)Get-ChildItem -ForceComprehensive directory listings
Filter by file typeGet-ChildItem -Hidden -Filter *.configFind specific hidden file types
Recursive searchGet-ChildItem -Hidden -RecurseDeep audits in nested folders
Detailed info`Get-ChildItem -HiddenSelect-Object FullName, Length, LastWriteTime`
By owner`Get-ChildItem -HiddenWhere-Object { $_.GetAccessControl().Owner -like “*” }`

Conclusion

In this tutorial, I explained how to list hidden files in PowerShell using various commands such as Get-ChildItem -Hidden and Get-ChildItem -Force, etc.

If you have any questions or want to share your own tips, drop them in the comments below—I’m always happy to help fellow PowerShell users!

You may also like the following tutorials:

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.