How to Search Files using CMD in Windows

Last Updated : 12 Jan, 2026

Have you ever lost an important file and found yourself clicking through countless folders trying to find it? The Windows Command Prompt (CMD) is a powerful built-in tool that helps you locate files quickly without needing any third-party software. .

1. How to Find Files Using CMD in Windows(10 & 11)?

In this section, we have mentioned some steps, so follow the few steps to get the lost file or file that you are looking for.

Step 1: Open CMD

  • To find your file first, open CMD or Windows Command Prompt, and to do this, click the Win+R button and type CMD, or you can click the Windows key and type CMD to open Windows Command Prompt.

Step 2: Use DIR Command

  • After successfully launching the Command Prompt, type the below command and press Enter to pull up a list of files and folders. 
dir

Step 3: Use CD Folder Command

  • For moving down into a particular directory, use the below command followed by a folder name,  until you reach the folder you want to search.
cd folder_name

Step 4: Use Aging DIR Command

  • Now type the dir command again but this time with your search term, follow dir with your search term in quotes with an asterisk term before closing the quotes (For example, type dir “Raveling*”) and press Enter. The command prompt will show you the file location along with the list of files name starting with a similar keyword. 
  • The asterisk is what’s known as a wildcard and, in our example, it stands for anything that follows the word ‘highlands’, such as ‘raveling.doc’, ‘raveling.xls’ or My Business plans.txt’.
  • If you don’t know the exact location of your file in your hard drive, then instead of manually navigating through your directories, start searching from the very top level of your hard drive and include every sub-folder.

Step 5: Use Raveling Command

  • The top level of the drive is represented by a backslash and, to include subdirectories, you add a forward slash and ‘s’ to the end of the query as shown below:
dir “\Raveling*” /s 
  • The above command is my all-time favorite because, with the help of this command, I don’t have to force my brain to remember the location of the files. This trick usually takes seconds to search the entire drive for the file.  
  • You can also search for a particular file type by using a command dir \*.pdf /s and it will show you all files saved with the .pdf extension. You can try this for other files too (for example: .doxc, .png, .exe and more).

Note: The position asterisk symbol in the command matters a lot so type carefully and check once before executing the command.

2. How All The Commands Works?

Now you know enough to find any file on your entire hard drive within few seconds but if you are more curious to know how all these commands are working and what all these symbols stand for, then continue reading this post.

Let’s discuss each term one by one:

  • dir command is for showing files on the current directory, but it can also show files from anywhere in the drive of the system.
  • / tells dir to search from the top-level or root directory of the hard drive.
  • /s is used for searching sub-directories.
  • * asterisk is using before text (for example *.pdf) show all files ending with .pdf and * using at the end (for example raveling*) show you all file-names starting with that word.
Comment