How to Search for Files by Name with PowerShell in Windows 11
Searching for files by name with PowerShell lets you locate files anywhere on your system without knowing their exact folder. This is faster than clicking through folders when you remember part of a filename but not where it is stored.
The Command
Get-ChildItem -Path C:\ -Filter "*report*" -Recurse -ErrorAction SilentlyContinue
What It Does
`Get-ChildItem` lists files, `-Path C:\` starts the search at the root of the C drive, and `-Recurse` makes it search through every subfolder. The `-Filter “*report*”` matches any file with “report” anywhere in its name, using asterisks as wildcards. The `-ErrorAction SilentlyContinue` part suppresses permission errors for folders you cannot YYGACOR access, keeping the output clean.
When You’d Use This
Reach for this when you remember part of a filename but not where it is stored, a common situation after saving something in an unfamiliar folder or hunting for a specific document across your drive. It searches everywhere under the path you give, so it finds files buried in subfolders that would be tedious to locate by clicking through folders manually.
Useful Variations
To search only a specific folder, change the `-Path` to that folder instead of C:\. To find a specific extension, use a filter like `”*.pdf”`. To search by name and type together, combine them, such as `”*invoice*.pdf”`. To show just the full paths, pipe the result to `Select-Object FullName`.
If It Doesn’t Work
If the search returns nothing, check your wildcard pattern and confirm the file’s name actually contains what you searched for. Searching from C:\ is thorough but slow, so if it takes too long, narrow the `-Path` to a likely folder. The `-ErrorAction SilentlyContinue` keeps permission errors from cluttering results; without it, protected folders produce many access warnings you can safely ignore.
Good to Know
Searching the entire C drive can take time and may return many results, so narrowing the `-Path` to a likely folder speeds things up considerably. The `-ErrorAction SilentlyContinue` part is worth keeping, since without it, protected system folders generate a stream of access errors.
Putting It Together
The command shown may look dense at first, but it breaks down into clear parts once you have used it a few times. As part of managing files from the terminal, this command earns its place once you are comfortable working without File Explorer. Combined with the others in this area, it lets you handle files in bulk and in scripts far faster than clicking through folders. Like anything in the terminal, the real value comes from trying it on your own system and adapting the variations above to what you actually need, so it is worth experimenting with in a safe, low-stakes situation before relying on it in a script or during troubleshooting. Keeping a note of the commands you find most useful, along with the variations that fit your workflow, turns scattered one-off tricks into a personal reference you can draw on whenever a similar task comes up again.