How to search for files and folders from Command Prompt on Windows 10

Windows search can find just about anything on your Windows drive. If you like the feature enough, you can extend the search to other drives on your system. There are other apps/utilities that you can install if you find Windows search isn’t as effective or you can search for files and folders from Command Prompt. Here’s how.

Search for files and folders from Command Prompt

Command Prompt can search a particular drive, or a specific folder for files and folders. By default, assuming you’re running it with ordinary user rights, it opens to your user folder and you may, or may not want to search that particular folder. This is why you need to know how to move Command Prompt to a different location.

If you want to search other non-window drives, you will need to switch to it first with the following command;

Syntax

drive_letter:

Example

D:

To move to a different folder, use the command below. The quote marks are only necessary if you have folders that have a space in their names in the path that you’re entering but it’s best to make a habit out of adding them

Syntax

cd "path-to-folder"

Example

cd "D:\Images"

how to search for files and folders from command prompt on windows 10 How to search for files and folders from Command Prompt on Windows 10

Search for files by type

The following command allows you to search the current folder for all files of a particular type.

Syntax

dir /b/s *.file_extension

Example

dir /b/s *.png

how to search for files and folders from command prompt on windows 10 1 How to search for files and folders from Command Prompt on Windows 10

The above command will look for all PNG files in the current directory and its sub-folders. The /s switch tells the command to include sub-folders, and the /b switch displays files without including metadata making the list easy to read.

how to search for files and folders from command prompt on windows 10 2 How to search for files and folders from Command Prompt on Windows 10

Search for files by name

To search for files by name, use the following command;

Syntax

dir *file_name*.* /s

Example

dir *arrow*.* /s

how to search for files and folders from command prompt on windows 10 3 How to search for files and folders from Command Prompt on Windows 10

The above command will look for all files that match the file name you entered regardless of the file type. If you want to narrow the search down by file type, enter the file extension after the period.

Example

dir *arrow*.jpg /s

Search for folders

To search a folder for sub-folders, use the following command;

Syntax

dir "Name of folder to search" /AD /b /s

Example

dir Images /AD /b /s

Remember that the above command will search the folder you enter for sub-directories. If you want to search a different folder, use the cd command to move to where the folder is located and then run the command.

how to search for files and folders from command prompt on windows 10 4 How to search for files and folders from Command Prompt on Windows 10

Search for folder with unknown name

If you’re not sure what the name of a folder is, you can use the following command.

Syntax

dir /s/b /A:D "D:*partial-name-of-folder*"

Example

dir /s/b /A:D "D:*Stea*"

how to search for files and folders from command prompt on windows 10 5 How to search for files and folders from Command Prompt on Windows 10

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.