Find and Open Files using Windows Command Prompt

Finding and opening files via Windows Explorer is easy, but it takes a bit longer. There is a faster way to accomplish the same thing: the Command Prompt. Command Prompt is the fastest way to get things done. Using Command Prompt, you can find things quickly and open the files directly. This guide works for Windows 10 and Windows 11.

Search a file in the Windows Terminal

Type cmd in the search bar of your Windows 10 computer. From the results, click on the command prompt to open it. Type the following line in command prompt window:

dir "\search term*" /s

Replace the search term with the file name that you want to search.

I will describe a little what the terms in the command actually means.

  • Dir - It is used to list the list of files and subfolders contained in a folder.
  • \ - It is used to tell dir to search from the root directory of the current drive.
  • * - It’s a wildcard character. if used before a name (e.g *data), will search for text that ends with that specific name data. If used after a name(e.g data*), will search the text starting with the name data.
  • /s - It is used to tell dir to search from all sub-directories

For instance to search a file name “data set”, I will enter”

dir "\screenshot3*" /s

Search for a file using Windows Terminal

It will list file names starting with the name screenshot3 along with its directory.

Open a file from Windows Terminal

After you find the file you want to open, you can launch it without navigating through windows file explorer.

In a command prompt window, type cd followed by the path of the file that you wish to open. After the path matches with the one in the search result. Enter the file name of the file and press Enter. It will launch the file instantly.

Using Windows Command prompt to open a file

By following the above method, you can easily search and open a file using the command prompt as it is a quick way of accessing any file as compared to windows file explorer.