Find and Open Files Using Command Prompt in Windows
[ad_1]
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, although it can be done. 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.
What Is the Benefit of Using the Command Prompt to Open Files?
Whether you are looking for all your files concerning one topic or just trying to find the one hiding among all the folders on your computer, try using the Command Prompt. It may make it more efficient for you.
On top of that, 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.
How to Open Command Prompt in Windows
To search for the files in Windows, you first need to launch Command Prompt. There are several ways to do this.
- Through Search Box. Type
cmd
in 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.
![Windows Command Prompt File Open Run As Administrator Search Menu](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-File-Open-Run-As-Administrator-Search-Menu.jpg)
- Use the Run window. A fast way to launch
cmd
is to press the Win + R keys on your keyboard. Then, typecmd
orcmd.exe
and press Enter or click “OK.” To directly launch Command Prompt in Admin mode, press Ctrl + Shift + Enter instead.
![Windows Command Prompt File Cmd Open From Run Menu](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-File-Cmd-Open-from-Run-Menu.jpg)
- Use Win + X: Another fast way to launch
cmd
is to use the Win + X combination, also known as the Power User menu. Among the various options in Windows 11, you will find Windows Terminal and Windows Terminal (Admin), which are the latest terminal emulators to run both Command Prompt and PowerShell from one window.
![Windows Command Prompt File Open Win X Open Windows Terminal Admin](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-File-Open-Win-X-Open-Windows-Terminal-Admin.jpg)
Note: In certain older Windows 10 versions, when you launch the Win + X hotkey, you might instead see the Command Prompt and Command Prompt (Admin) options.
![Windows Command Prompt File Open Command Prompt Admin Windows10](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-File-Open-Command-Prompt-Admin-Windows10.jpg)
- Use Cortana: Try 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.
![Windows Command Prompt File Open Start Command Prompt From Cortana](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-File-Open-Start-Command-Prompt-from-Cortana.jpg)
How to Search for Files Using Command Prompt in Windows
Searching for files and folders using the command line is very easy. Follow the instructions below:
- In 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.”
![Windows Open Files Command Prompt Search Dir Search Term](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Open-Files-Command-Prompt-Search-Dir-Search-Term.jpg)
- 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?:
dir
is 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. /s
tellsdir
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.- Adding 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 use it at the beginning, your search will only include results with your text at the end. For example,
*.jpg
. - If you add 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.
How to 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 drive path in command line as below.
- Type
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.
![Windows Open Files Command Prompt Cd Change Directory One Step At A Time](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Open-Files-Command-Prompt-CD-Change-Directory-One-Step-At-A-Time.jpg)
- Using
cd
without the two dots allows you to set a new folder path as the default directory for systematic file navigation. - Using
cls
clears the entire screen and returns you to the previous folder path.
![Windows Open Files Command Prompt Cls Command](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Open-Files-Command-Prompt-Cls-Command.jpg)
How to Open Files in Command Prompt by File Name and File Type
We will explore a simple demonstration of how to open a file clearly visible to you as system administrator. To do this you would need the location of the saved file. In this example, the file that we want to open is located in the Desktop folder.
- Navigate to the required folder from “This PC” and right-click to select “Properties.” This would give you that folder’s path unique to your computer.
![Windows Command Prompt Desktop Properties](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-Desktop-Properties.jpg)
- Using
cd
change your Command Prompt’s root directory to the desired folder.
![Windows Command Prompt Change Folder To Desktp](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-Change-Folder-to-Desktp.jpg)
- Once you’re set to the right folder, open the file by simply typing the entire
filename
and.filetype
. In the following example, the filename is “Marathon” and the filetype is an .MP4 video.
- After typing the filename/filetype command, the correct file will be launched on your desktop window.
![Windows Command Prompt File Open File Name Filetype Desired Folder](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-File-Open-File-Name-FileType-Desired-Folder.jpg)
How to Search for the Correct Files With 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.
![Windows Open Files Command Prompt Dir Open Specific File](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Open-Files-Command-Prompt-Dir-Open-Specific-File.jpg)
If the folder path is very long, you can copy-paste the entire thing. Windows 11 has built-in support for copy-pasting in command line.
For Windows 10, check out this detailed tutorial on how to cut-copy-paste in the 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.
![Windows Command Prompt Fileopen Copypasting Command Prompt](https://www.maketecheasier.com/assets/uploads/2021/11/Windows-Command-Prompt-FileOpen-CopyPasting-Command-Prompt.jpg)
How to Open Files in Windows 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
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. - Enter the file name inside the quotation marks
".."
. Press Enter and the file will open using its default application.
Note: 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.
![Windows Command Prompt Fileopen Open Directly Filepath](https://www.maketecheasier.com/assets/uploads/2021/11/Windows-Command-Prompt-FileOpen-Open-Directly-FilePath.jpg)
- 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 want to use to open the desired file.
![Windows Command Prompt Fileopen App Open File Location](https://www.maketecheasier.com/assets/uploads/2021/11/Windows-Command-Prompt-FileOpen-App-Open-File-Location.jpg)
- 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.
![Windows Command Prompt Fileopen App Path Defined](https://www.maketecheasier.com/assets/uploads/2021/11/Windows-Command-Prompt-FileOpen-App-Path-Defined.jpg)
- Use
"App Location Path" "File Path"
to open the file with the app of your choice in Command Prompt.
![Windows Command Prompt Fileopen Open File Using Specific App](https://www.maketecheasier.com/assets/uploads/2021/11/Windows-Command-Prompt-FileOpen-Open-File-Using-Specific-App.jpg)
Navigating your computer’s files using the Command Prompt is very similar to doing the same with File explorer.
How to Open Files Using Windows Terminal
The Windows Terminal is just a modern extension of the Command Prompt. Opening files in Windows Terminal is no different from the above methods.
- You need to change the default Terminal application to Command Prompt from a “+” menu if it’s set at something else, such as PowerShell or Azure Cloud Shell.
![Windows Command Prompt Open Files Open Cmd In Windows Terminal](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-Open-Files-Open-Cmd-in-Windows-Terminal.jpg)
- Once you do it, the Command Prompt will become the default Terminal application for you to open any files.
- In the following Windows Terminal example, we’ve typed
cd..
to navigate to theC:Windows
folder. - From there, we opened the Registry Editor file in that location by simply typing
regedit
.
![Windows Command Prompt Open Files Regedit C Windows](https://www.maketecheasier.com/assets/uploads/2022/08/Windows-Command-Prompt-Open-Files-Regedit-C-Windows.jpg)
Frequently Asked Questions
Can 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 folder, navigate to the folder first, then right-click Windows terminal. The command prompt can be accessed as a part of the Windows terminal.
How do I display the contents of a text file in Command Prompt?
To display the contents of a text file in command prompt, enter the type
command as shown below:
type [<drive>:][<path of file>]<Name of File>
Can I edit text files in Windows Command Prompt?
You can edit, view, create or modify any text document in command prompt.
- Use command
type
followed by the file name. - Copy-paste the text in the command window using
copy con
followed by the text name and location. - Start editing the document.
Can I batch rename files in Command Prompt?
Image credit: claudiodivizia by 123RF. All screenshots by Sayak Boral
Is this article useful?
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
[ad_2]
Source link