A lot of users are confused about the PowerShell find file operation on Windows 10/11. In this post, MiniTool will introduce a full guide on how to find files using PowerShell and an alternative to PowerShell find files.

PowerShell is a powerful Windows built-in command-line shell and scripting environment tool. It can be used to deal with a wide variety of works such as PowerShell run exe,  PowerShell copy filesPowerShell gets folder sizePowerShell get disk space, and the one discussed here.

However, a lot of users and even professionals don’t know how to perform these operations in PowerShell. These questions are heatedly discussed in different forums, but lack detailed steps and clear screenshots. That’s why we write this post to show you how to find file PowerShell on Windows 10/11.

PowerShell find file recursively. 312. I am searching for a file in all the folders. Copyforbuild.bat is available in many places, and I would like to search recursively. How can I do it in PowerShell?


Disk Column Missing from Task Manager Windows 11/10/8/7? [Fixed]
Disk Column Missing from Task Manager Windows 11/10/8/7? [Fixed]

Are you troubled by the disk column missing from Task Manager issue? This post will help you fix the error and introduce a disk performance monitor utility.

Read More

Can PowerShell Find Files

Can PowerShell find files on Windows 10/11? Of course, yes! You can use the Get-ChildItem cmdlet can help you find files PowerShell easily in different cases. This command can show a list of files or directories in one or more specified locations. In addition, you can use the Recurse parameter to let PowerShell find file recursively from all the child containers.

How to Find Files PowerShell on Windows 10/11

How to find file PowerShell on Windows 10/11? The answer varies depending on your needs.  Here we summarize several common examples related to PowerShell search for a file.

To open the elevated PowerShell window, type powershell in the search box, right-click Windows PowerShell and select Run as administrator and click on Yes to confirm it. Once opened, you can try the following commands to find file PowerShell.

Example 1. PowerShell Search for Files on the Root of Drive D:

If you want to list all directories stored on the root of a specific drive, you can type the following command in PowerShell window and hit Enter. Here you can replace D with the drive letter where you want to find files.

Get-ChildItem -Path D:

PowerShell find files on the root of the D drive

Example 2. PowerShell Search for Files with a Specified Extension

If you want to make PowerShell search for a file with a specified extension such as “.exe”, you can run the following command

Get-ChildItem *.exe

PowerShell find files with a specified extension

Example 3. PowerShell Find File Recursively on the Root of the D Drive

If you want to PowerShell search for files recursively stored on the D: drive, you can run the following command.

Get-ChildItem -Path D: -Recurse

PowerShell search files recursively

Example 4: PowerShell Find Files Recursively That Don’t Match a Specified Extension

If you want to find all files in the current directory that do not match a specified extension, you can use the Exclude parameter. For example, to list all files that exclude .txt files in the current directory, you can run the following command.

Get-ChildItem -Exclude *.txt -Recurse

PowerShell find files exclude txt files

Example 5. PowerShell Search for a File in the Directory that Matches a Pattern

If you want to find a file in a directory and subdirectory recursively that matches a specified pattern using the wildcard like “*.doc,*.docx”, you can run the following command.

Get-ChildItem -Include *.doc,*.docx -File -Recurse -ErrorAction SilentlyContinue

PowerShell find files with the doc extension

Example 6. PowerShell Search Files that Match Specific Filter

For example, to recursively find all files in subdirectories that match specific filters like “*.txt”, you can run the following command. It can help you get only .txt file extension files in the subdirectories.

Get-ChildItem -Filter *.txt -Recurse

PowerShell find files recursively with txt extension

Best Alternative to PowerShell Find Files

As discussed above, it can be concluded that PowerShell is a professional tool to list files in directory. However, it is time-consuming and not friendly for those who are not familiar with the PowerShell cmdlets. If you are unclear about the correct cmdlets, you will encounter various issues such as “can’t find the path”, “access is denied”, etc.

So, it’s highly recommended you use an effective alternative to PowerShell file search – MiniTool Partition Wizard. Its Space Analyzer feature can help you list all files/folders/directories/subdirectories on a drive quickly.

Moreover, you can search for a specific file via its name or extension with the MiniTool software. If your hard drive or C drive is full, it also tells you what files are taking up your disk space and helps free up disk space.

MiniTool Partition Wizard FreeClick to Download100%Clean & Safe

search for a file using MiniTool

  • linkedin
  • reddit