The Windows Command Prompt can be used to search for and open any files on your PC. This is very useful if you saved your file to an unknown folder and only remember a part of the file name. However, there’s no benefit in applying this method to files with a known location. But for those files that are difficult to locate, this article shows how to find and open files in command prompt in Windows 11 and Windows 10.
How to Open Command Prompt in Windows 11/10
To search for the files in Windows 10 and 11, you first need to launch Command Prompt. There are several ways to do this.
- Through Search Box. Type
cmdin the Windows search box, then click on the icon to open the window. It’s wise to always operate the command line as an administrator.
- Use the Run window. A fast way to launch cmd is to press the Win + R keys on your keyboard. Then, type
cmd.exeand press Enter or click “OK.”
- Use Cortana: Use Cortana if it works for you. As soon as you see the Cortana is “listening” text, say “open command prompt,” and it will open up.
How to Search for Files Using Command Prompt in Windows 11/10
Searching for files and folders using the command line is very easy. Follow the instructions below:
In the command prompt, type
dir "search term*" /s but replace the words “search term” with the file name or a part of the name you remember. In the following screen we are trying to search for a folder/file titled “Stock videos.”
Once you press Enter, it may look like nothing is happening for a second or two, but soon all the file paths mentioning the correct file or folder will be identified and named. The correct file path can be easily identified by the size of the folder.
What do all the terms mean in the command line search request?
diris a command used to show files in the current directory but can also locate data elsewhere in the system.
- The backslash (
\) tells dir to search from the root directory of the current drive.
/stells dir to search all sub-directories.
*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, your search will only include 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 Directories in Windows Command Prompt for Easy Access to Folder Paths
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 change the Windows 11/10 drive path in command line as below.
cd..which enables you to easily move one folder up.
- To go to D drive, just type
d:, and the command prompt will listen to the new drive.
cdwithout the two dots allows you to set a new folder path as the default directory for systematic file navigation.
clsclears the entire screen and returns you to the previous folder path.
Search for the Correct Files Using Command Prompt
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. If you type correctly, you will identify the folder path and the correct file name.
If the folder path is very long, you can copy-paste the entire thing. Windows 11 has built-in support for copy-pasting in comand line.
For Windows 10, check out this detailed tutorial on how to cut-copy-paste in the Windows 10 command prompt. 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.
Open Your Files in Windows 11/10 Command Prompt
Once you find the file you want to open, you can open it from the command prompt screen using its default program without having to locate it in your file explorer.
- Change the directory to the immediate folder where the file is located. This can be done using
cdfollowed 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.
- Enter the file name inside the quotation marks
"..". Press Enter and the file will open using its default application.
You can open multiple files from the command prompt once you’ve opened the correct folder. Here we open a single video file in the command line window.
You can use specific apps to open the file of your choice in command prompt. For example, video files can be opened using VLC Player.
- Identify the file location of the app you wan to use to open the desired file.
The file location of the app is accessible in “Properties.” Copying the path is useful, as it will be pasted directly in the Windows Command line.
"App Location Path" "File Path" to open the file with the app of your choice in command prompt.
Navigating your computer’s files using the command prompt is very similar to doing the same with File explorer.
Frequently Asked Questions
1. How do I open the command prompt window in a Windows folder?
You can open the command prompt window anywhere in a Windows PC. To do so in a Windows 11/10 folder, navigate to the folder first, then right-click Windows Terminal. The command prompt can be accessed as a part of the Windows terminal..
2. Can I edit text files in Windows command prompt?
You can edit, view, create or modify any text document in command prompt.
- Use command
typefollowed by the file name.
- Copy-paste the text in the command window using
copy confollowed by the text name and location.
- Start editing the document.
Whether you are looking for all your files concerning one topic or just trying to find the one 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 much 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.