How to Find and Open Files Using Command Prompt in Windows 10

Have you ever forgotten where you stored a file on your computer or simply couldn’t remember part of the name of a file you desperately needed to find? If you knew how to find and open files (pictures, text, video, music) and folders using Command Prompt (CMD) in Windows 10, you could easily save yourself the trouble. command line interface useful in certain situations, to open files and folders under normal conditions.

Find and Open Files and Folders Using Command Prompt in Windows 10

Command Prompt offers lots of great tricks and gives you access to many Windows features that are not accessible from the GUI. Here we will show you how to find and open files using Command Prompt. You can do this using Windows File Explorer, but if you forget the exact file name or don’t remember where you stored it on your computer, the methods detailed below will help you.

Note: I’m using Windows 10 for this demo, but the same methods will work on Windows 7/8/8.1 and older. You can also use the following methods to find and open any type of folder or file in Windows 10 command prompt (CMD), including text, video, music and more..

Find a File or Folder Using Command Prompt

  • Open Windows Command Prompt in Administrator mode by searching for ‘cmd’ in the Windows Search Bar and selecting ‘Run as administrator’.

  • write now dir "\*file name*" /s To search for the target file on your C:\ drive. Be sure to replace “filename” with the actual name of the file or folder you are trying to find. I am trying to find a file named ‘demo1.jpg’ for this demo.

command prompt

  • Even if there is only one file with that name, you will get multiple results. However, you can easily determine the right path by its size.

specify folder location using command line

  • By default, the command mentioned above will search the C:\ drive. If your PC has more than one drive, you will need to specify the target drive. For example, to search for drive D:\ you would type:d: and press Enter.
In relation :  How to Downgrade from iOS 9 to iOS 8

Change driver in CMD

now only dir "\*file name*" /s The command described earlier to find your target file or folder.

Also note that you can only use one asterisk (instead of two) at the beginning or end of the filename. Putting a wildcard at the end will find all files that contain your search term at the beginning of the name, while putting it at the beginning lists all files with your search term at the end. I put an asterisk at both ends to find all files containing the search text, at the beginning, at the end, or somewhere in between.

Open Files Using Command Prompt

Once you know the full path of a file (image, text, video, music) or folder, you can easily open it using Command Prompt in Windows 10. Here’s how to do this:

Method 1: Open Files Via Folder in Command Prompt

  • First, specify the directory and folder of the file you are trying to open. In my case, the target file is located in a folder called ‘Demo Folder’ in the root of the D: drive. So, first we will go to the root of the D: drive. For this type d:and press Enter as detailed in the previous section. You can leave this step if you are trying to open a file on the C: drive.
  • Now access the target folder with the following command: cd demo folder/

acees folder in command prompt

  • Finally, type "demo2.jpg"(including the quotes) and press Enter.

find file in command prompt

Windows opens the file using the default application associated with that file type.

Method 2: Open Files Directly in Command Prompt

By the way, you can also open files directly from the command prompt if you know the full file path. Here’s how to do it:

  • Say you want to open a file at "C:\Users\<username>\Desktop\Stuff\Img\Jan 2021\28 Jan\CMD\demo1.jpg". For that, open Command Prompt and make sure you point it to the correct driver first. Next, type the full path (including the quotes) and hit Enter.

Open Files Directly With Command Prompt

Specify an Application to Open Files Using Command Prompt

In both cases mentioned above, the file will be opened using the default application associated with that file type. However, you can specify any application on your PC to open this file. Let’s say your JPG files open with Adobe Photoshop by default, but you can open them with Paint (or any other compatible application) if you prefer. Here’s how to do it:

In relation :  How to Select Spotify as Default Music Service on Amazon Echo

  • To open the same ‘demo1.jpg’ file using Paint, we will need to point the operating system to the ‘mspaint.exe’ installation folder along with the full path to the file. For this we will use the following syntax: "%windir%\system32\mspaint.exe" "C:\Users\Kundu\Desktop\Stuff\Img\Jan 2021\28 Jan\CMD\demo1.jpg"(including citations).

Specify an Application to Open Files Using Command Prompt

The above command will open the ‘demo1.jpg’ file with MS Paint instead of the default photo viewer app on your PC. Note that file paths may vary from one computer to another.

Get Things Done Using Command Line Tools in Windows 10

Now that you know how to find and open files and folders using Command Prompt in Windows 10, go ahead, give it a shot and let us know why you want to use Command Prompt to find and open files on your PC. . If you like working with command-line tools on Windows, but the more feature-rich PowerShell is your weapon of choice, check out our tutorial on how to customize Windows PowerShell on your PC. You can also control everything about the Windows Terminal and how to install and customize it on your computer.