X

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.

Cmd Location Windows 10 and Windows 11

Before we start searching files on the command prompt, you must open the Terminal or command line. There are several ways in doing so:

  • Open the Start menu and type cmd in the search field to cli open file.
  • Use the Windows run box, type Windows + R enter the command cmd, and press the return key.
  • Press the Windows + X key on the keyboard to open the power menu and there click on Command Prompt.

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

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

How to see files in cmd

Another important thing to know is how you can view files in command prompt. The command to view the content of a folder is the dir command.

dir <directory name>

so you use dir command followed by file path or folder path.

Using dir without a directory name will show the content of the current directory.

Now, if you want to change directory, use the cd command.

cd <folder name>

By using the magic folder name "..", you can go to the parent 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 (specified file). After the path matches the one in the search result. Enter the file name of the file and press Enter to cmd location in c drive. It will launch the file instantly.

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. You can also do this with multiple files.

Get help for dir command

To get cmd commands list for the dir command, run:

dir /?

to get a list of available command-line options.

Categories: Windows
FAQForge Staff:
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings