Search for a file with wildcards in the path using Windows command line

Windows PowerShell can do this easily.

Get-ChildItem C:\Users\*\AppData\Local\*.txt

If you want to include subfolders:

Get-ChildItem C:\Users\*\AppData\Local\*.txt -recurse

Regarding Hidden (etc.) files, Powershell's help Get-ChildItem says:

By default, Get-ChildItem gets non-hidden items, but you can use the Directory, File, Hidden, ReadOnly, and System parameters to get only items with these attributes. To create a complex attribute search, use the Attributes parameter. If you use these parameters, Get-ChildItem gets only the items that meet all search conditions, as though the parameters were connected by an AND operator.


Any good Unix shell for Windows will do this.

For example, here's a screenshot of my Hamilton C shell doing your example (sorry, no matches) and a couple others that do produce matches. The ... wildcard used in the third example matches zero or more directory levels, whatever it takes for the rest of the pattern to match.

Wildcarding using Hamilton C shell on Windows 7 x64

And here's how you might do it with Cygwin bash. A few differences here because Cygwin follows Unix conventions: Paths are usually typed with forward slashes and the backslash is the escape character. Since Unix doesn't understand drive letters, they've introduced a /cydrive/c notation to refer to the C: drive. As on Unix, wildcarding is case-sensitive. And while it supports the usual multiple directory level wildcarding you'd like, it doesn't include the ... I added to my shell. (Instead, you'd probably use find.)

Wildcarding using Cygwin bash on Windows 7 x64


In cmd, navigate to C:\Users, and run

dir /s /b | findstr AppData\Local | findstr txt

Explanation: dir /s lists all files recursively, /b displays full path, and within all these child files, use pipeline operator to search both the string 'AppData\Local' and 'txt'.