Do you ever drive yourself crazy looking for all the files you need for a project? Have you saved them in unknown 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 directly from that location.
We have to mention, though, that it’s a waste of time using the Command prompt to open simple, trivial files. However, this method is something you should definitely look at when dealing with multiple files and assorted file types in random folders.
Opening Command Prompt
To search for the files you want, first launch Command Prompt. There are several ways to do this.
cmdin the Windows search box, then click on the icon to open the window. It’s preferred to run the command prompt as an administrator.
- Use the Run window. A fast way to launch this window is to press the Win + R keys on your keyboard. Then, type
cmd.exeand press Enter or click OK.
- Use Cortana if it works for you properly: as soon as you see the Cortana is “listening” text, say “open command prompt,” and it will open up.
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. In the following screen, we are trying to search for a folder/file named “movies.”
The correct file path can be easily identified by the size of the folder. 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. But soon all the file paths mentioning the correct file or folder will be identified and named.
What do all the terms in the command mean?
diris 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.
/stells dir to search all subdirectories.
*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,
- 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.
Change Command Prompt Directories for Precise File Location
If your target file is located in D: drive, you won’t find it anywhere in the Windows folder from the C: drive. Therefore, you should learn to change the drive path as shown below.
cd.., which will enable you to easily move one folder up. To go to D drive, just type
d:, and the command prompt will now listen to the new drive.
Within the destination drive, you can search for the correct file once again using the
dir "\search term*" /s command discussed in the previous section. Do take care to use the
* wildcard, both at the beginning and end of the search term for a comprehensive search – especially if that folder has hundreds of files. It’s pretty common to make mistakes in the wildcards and backslash, which returns a “no label” error as shown below. If you type correctly, you will easily identify the folder path and the correct file name.
If the folder path is very long, you may want to copy-paste the entire thing. We have a detailed tutorial on how to cut-copy-paste in the Windows 10 command prompt. But the method is simple enough: use Ctrl + A to select the entire command prompt screen, then just release the mouse or trackpad click. This would make any part of the command screen selectable for a copy-paste action as shown below.
Open your Files in Windows 10 Command Prompt
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.
First, change the directory to the immediate folder where the file is located. This can be done using
cd followed by the entire folder path to the correct file. It’s common to make mistakes, so it’s better to copy-paste the entire folder path as discussed in the previous section. Once the correct directory menu has been opened, you can open any files there. Here it’s a folder, where I saved my personal collection of rented movies.
Enter the file name inside the quotation marks
".." as shown here. Press Enter and the file will open using its default application. Here it’s Movies and TV programs, which is set as my default application for .mp4 files.
The file, a Mel Gibson-led movie called “Get the Gringo,” opens from the command prompt.
You can open multiple files from the command prompt once you’ve opened the correct folder. Here we open another file called “Erin Brockovich.mp4” in the same folder.
The file, a Julia Roberts-led movie called “Erin Brockovich,” opens from the command prompt using the default app.
Once you’re done, you may want to move back to another folder in the command prompt. For this, use
cd.. followed by a
new drive name as shown below. Navigating your computer’s files using the command prompt is very similar to just doing it in a regular way from your File explorer.
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.
Amazingly, the command prompt is way faster and more responsive than opening the files from the File Explorer. This is true for video files, Windows Photos, Word documents, and heavy-duty games. The reason for this is that the GUI always consumes more memory and slows down the processes.