1. Home
  2. Windows Tips
  3. Search for files and folders from command prompt windows 10

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"

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

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.

Search for files by name

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

Syntax

dir *file_name*.* /s

Example

dir *arrow*.* /s

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.

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*"

1 Comment

  1. This was useless. The entire page is dedicated to how to use wildcards to list out files and folders with specific strings in their names and has nothing to do with searching the entire drive letter for a file or folder that contains a string in its name from the drive parent.