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

Feb. 16, 2021



Did you ever forget where you stored a file on your computer or simply couldn’t recall part of the name of a file that you desperately needed to find? You could have easily saved yourself some headache had you known how to find and open files (image, text, video, music) and folders using Command Prompt (CMD) inWindows 10. While it is a waste of time and energy using acommand line interfaceto open files and folders under regular circumstances, it comes in handy under certain situations.

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

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

TheCommand Prompt offers a lot of cool tricksand lets you access a lot ofWindows features, including many that are not accessible from within the GUI. Here, we will show you how to find and open files using the Command Prompt. While you can do it using the Windows File Explorer, the methods detailed below will help you if you forget the full filename or don’t remember where you stored it on your computer.

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

Now just use thedir “*file name*” /scommand described earlier to find your target file or folder.

Do note that you can also use just one asterisk (instead of two), either at the start or at the end of the filename. Putting the wildcard at the end will find all the files with your search term at the beginning of the name, while putting it at the start will list all files with your search term at the end. I’m putting the asterisk at both ends to find all files that include the search text, whether at the start, end or somewhere in between.

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

Windows will open the file using the default app associated with that file type.

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

In both the aforementioned cases, the file will be opened using the default app associated with that file type. You can, however, specify any app on your PC to open that file. Say, your JPG files open with Adobe Photoshop by default, but you can open it with Paint (or any other compatible app) if you want. Here’s how you do it:

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

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

Passionate techie. Professional tech writer. Proud geek.