How to use Command Prompt to find any file

  • Command Prompt (CMD) allows you to run commands to manage files efficiently.
  • CMD can be opened from various methods in Windows 10 and earlier versions.
  • The 'dir' command allows you to search for files and folders based on different criteria.
  • The 'find' command searches for specific text within files, displaying relevant lines.

system symbol

Almost all of us have numerous documents and files saved on the storage drive of our computers. We also have some of them distributed in folders in different locations. A mess. This makes it considerably difficult to find and organize these files. That is why it is very interesting to know how to use command prompt to search any file in our team.

This can be a much more effective alternative than using the File Browser, if we are able to handle it well. The only thing we have to do is learn to get used to handling the command line (CMD). In this article we explain how to do it:

What is Command Prompt?

cmd

Although almost all Windows users already know it, it never hurts to remember what exactly the Command Prompt, also called cmd.exe, cmd or Command Prompt. It is an application, not a program that is part of the operating system.

Its function is to execute many functions that are normally performed from the graphical interface. These functions are activated through specific commands. Some of them are very useful to solve some common Windows problems. In this article we list All the commands every Windows user should know to get the most out of this tool.

Some of these commands can help us with the task, mentioned above, of searching for files on our computer, as we will see below.

How to open Command Prompt?

cmd

Depending on which version of the operating system we are using, we will have to use a specific method to open the Command Prompt or CMD. These are the options:

On Windows 10 and Windows 11

There are two ways to open the command console in Windows 10 and Windows 11:

  • The first: access the Windows search box, write there CMD and then click Symbol of the system.
  • The second: resort to the key combination Windows + R, then type cmd.exe in the window Run and finally press Enter.

In earlier versions of Windows

If you have a PC that still works with a version of the operating system prior to Windows 10, this is what we should do:

  1. To begin, we move the mouse pointer to the lower left corner of the screen.
  2. Then we click with the right button (or use the key combination Windows + X).
  3. Then, in the power user task menu, we select Command Prompt.

How to search for files with the Command Prompt

Now that we are clear about what the Command Prompt is and how we can open it on our PC, we can now focus on the central object of our post: how to use the Command Prompt to search for a file. These are the steps to follow:

By default, when you open CMD it will appear the letter corresponding to the Windows drive (C:). If we want to search for other drives other than Windows, we will first have to change the letter that corresponds to the drive we need (D:, E:, etc.). After, we will add the backslash symbol and we will write the name of the folder or file below. For example:

C:\BlogFiles

Command dir

dir command

But many times we do not know the exact name of the file we are looking for. When this happens, the Command Prompt gives us the opportunity to perform searches based on different criteria through the command dir:

Search by type

There is a command that allows us find all files of the same type within a specific folder. For example, with the command dir /b/s *.doc + Enter, all files with a .doc extension that are saved in this folder will be displayed.

In this example, the /s switch is used to tell the command to also include subfolders in the search; On the other hand, the /b switch is used to display files without including metadata, for easier reading.

Subfolder Search

If what we need is search for subfolders or subdirectories contained within a folder, this is what we should do. For example, writing dir DOCUMENTS /AD /b /s + Enter, a list of the folders contained within the main Documents folder will appear on the screen.

Search for folders with unknown names

This is the best option for find that folder that we are looking for, but whose exact name we do not know or do not remember. It is about using as a "clue" one of the words that could appear in the title of that folder. Here is an example: dir /s/b /A:D «D:Notes» +Intro. In this way, the search will be extended to all folders and subfolders on the D: drive that contain the word "notes."

Command find

This command allows us to find files based on certain words. He command find searches for a specific text string in one or more files. Then, in the results, it shows the lines of text where it is located. This is its basic syntax:


Add as preferred source in Google