There are a few different ways to open files using the command prompt. The most common way to open files is by using the Windows command prompt. To use the Windows command prompt, you need to be logged on as a user with administrator privileges. To start the Windows command prompt, type the following command at the Windows command prompt: C:\Windows\system32>cmd
Once you’ve learned how to navigate directories on Windows 10, the next step is learning how to find and open files using the Command Prompt. It’s just as easy as navigating through and opening a file in File Explorer. Here’s how it’s done.
First, open the Command Prompt on your PC by typing “cmd” in the Windows Search bar and then selecting “Command Prompt” from the search results.
With the Command Prompt opened, you’re ready to find and open your file.
Find Files Using Command Prompt
Maybe you already know the file path to the item you want to open–maybe not. If not, you don’t need to search through File Explorer just to come back to the Command Prompt later. You can use this command instead:
dir “\search term*” /s
Just replace “search term” with, of course, the actual search term. So, if we wanted to locate our file called “Example File,” we’d use this command:
dir “\example file*” /s
Command Prompt will now search and find all instances of the search term you entered. It will (1) show you the file path, and (2) give you the file name and extension.
Now that we’ve found our file, let’s open it.
RELATED: How to Use File Explorer Without a Mouse on Windows 10
Open Files Using Command Prompt
To open the file, you need to navigate to the directory in the Command Prompt that contains the file you would like to open. In this example, we’ve created an “Example” folder in our “Documents” folder, so we’ll head there.
In Command Prompt, use the Change Directories command ( cd
cd Documents\Example
Note that you must navigate to the immediate file structure. In this case, we can’t skip “Documents” and jump straight to “Example.”
Once you have inputted your command, press the Enter key. You’ll now be in that folder.
It’s now time to open the file within that folder. Our file is named “Example File.”
To open the file, enter the file name and extension in quotations. In this case:
“example file.docx”
The file will now open.
To make things a bit quicker, you can actually navigate to the correct folder and open the file in a single command. Assuming we are back at the top level, we would run this command:
“Documents\Example\example file.docx”
The only difference is you don’t add the cd command and the entire path is in quotations.