How to Find and Open Files Using Command Prompt in Windows

Do you ever drive yourself crazy looking for all the files you need for a project? Do you save them in different places on your computer? Can you only remember part of the name you gave the file? If any of these apply to you, using the command prompt instead of Windows Explorer may help you quickly find the files you need and allow you to open them right there.

Open Command Prompt

To search for the files you want, first launch Command Prompt. There are several ways to do this.

  • Type cmd in the Windows search box, then click on the icon to open the window.


  • Use the Run window. A fast way to launch this window is to press the Win + R keys on your keyboard. Then, type cmd or cmd.exe and press Enter or click OK.


  • Press the Win + X keys on your keyboard, and choose command prompt. You can also do it with a right-click on the Windows logo in the bottom-left corner. If you are running Windows 10 and this gives you the option of working in PowerShell instead of command prompt, you can change it to the command prompt by opening “Settings -> Personalization – > Task bar” and flipping the toggle switch to choose command prompt again. This is important because these instructions will not work in PowerShell.


Search for your files

In the command prompt type dir "\search term*" /s, but replace the words “search term” with text you want to find by using the file name.


What do all the terms in the command mean?

  • dir is a command used to show files in the current directory, but which can also locate data anywhere in the system.
  • The backslash tells dir to search from the root directory of the current drive.
  • /s tells dir to search all subdirectories.
  • Finally, * is used by command-line apps as a wildcard. It indicates that the search will locate all file names that contain your search term.
  • Putting an asterisk at the end of the name, like business*, will find all the files with your search term at the beginning of the name.
  • If you put it at the beginning, then your search will include only results with your text at the end. For example, *.jpg.
  • If you put an asterisk at each end of the search term, you will cover all the bases. No matter where your text is in the actual name of the file, that file will be listed in the results.

Once you have typed in the command, press Enter, and the search begins. It may look like nothing is happening for a second or two, though.


As you can see, my results for zebra gave me thirty different files.

Open your files

Once you find the file you want to open, you can open it from this screen, using its default program, without locating it in your file explorer.

Change the directory. Find the directory that contains the file you want to open.

Type cd and the path for the directory you want to open.

After the path matches the one in the search, type or copy and paste the name of the file on the command line.


Press Enter and the file will open using its default application.


If you are looking for all your files concerning one topic or just trying to find the one that is hiding among all the folders in your computer, try using the command prompt. It may make it more efficient for you.

Tracey Rosenberger Tracey Rosenberger

Tracey Rosenberger spent 26 years teaching elementary students, using technology to enhance learning. Now she's excited to share helpful technology with teachers and everyone else who sees tech as intimidating.

One comment

Comments are closed.