How to Open a File or Folder in Command Prompt (CMD) in Windows 11

We show you how to quickly open a file or folder in Command Prompt / how to change directory in command prompt in Windows 11 using a series of commands.

Featured - How to Open a File Folder in Command Prompt Windows 11

Many of the tasks you can perform via your UI, you can also do in . This extends to opening files and folders, which you may want to do if you're using a GUI-less install, or your File Explorer is broken. Today we're going to show you how to open a file or folder in Command Prompt in 11 in just a few seconds.

To do so, we'll be making use of the new Windows Terminal application, which allows you to quickly CMD, PowerShell, and more.

How to change directory in command prompt

As part of the process, this tutorial will briefly cover how to navigate to files in CMD. It won't, however, show you how to open Command Prompt in a specific folder, as we already have a tutorial on that here. With that said, lets' get started:

How to Open a File in Command Prompt

To open a file using Command Prompt, you just need to navigate to its folder and then type the file name. Here's an example:

  1. Right-click your Start button and press “Windows Terminal (Admin)”

    Windows 11 - Open Elevated Windows Terminal

  2. Click the dropdown arrow next to the plus icon and select “Command Prompt”

    Windows 11 - Elevated Windows Terminal - Open Command Prompt

  3. Navigate to your desired folder with “cd”, then type your file name in quotes

    For example, our file is in the “wonder” folder on our desktop. To get there, you would type:

    cd C:\Users\User Name\Desktop\wonder

    We know that the file is called “cafe” and is a jpeg filetype, so to open it we can just type "cafe.jpg" and press Enter.

    If you're unsure what your file is called, you can type ls while in a folder. This will list every file inside of it in CMD.

    Windows 11 - Elevated Windows Terminal - Command Prompt - Enter the Cmds to Open File

  4. Your file will open in its default program

    Windows 11 - Elevated Windows Terminal - Command Prompt - Enter the Cmds to Open File - File Opened

  5. Try opening a different file type

    This trick works not just with images, but documents and basically any file on your PC that you have the to open. In the example below, we navigate to a folder on the desktop and then open an excel worksheet:

    cd C:\Users\Maria Winbuzzer\Desktop\wonder

    "2019.xlsx"

    Windows 11 - Elevated Windows Terminal - Command Prompt - Enter the Cmds to Open File

  6. Your Excel workbook will open in its default program: Excel

    Windows 11 - Elevated Windows Terminal - Command Prompt - Enter the Cmds to Open File - File Opened

How to Open a Folder in CMD

Opening a folder in Command Prompt is even easier. You can do it in a single command. It's not the easiest to remember, but every convenient once you have it down. Note that this is different from navigating to a folder in CMD because it will actually open the file in Windows Explorer:

  1. Type the following command and Press Enter

    With Command Prompt selected in your terminal type the following command and substitute the folder path with one to the folder you want to open:

    start %windir%\explorer.exe "C:\Users\Maria Winbuzzer\Desktop\wonder"

    Windows 11 - Elevated Windows Terminal - Command Prompt - Enter the Cmd to Open Folder

  2. Windows will open your folder in File Explorer

    Windows 11 - Elevated Windows Terminal - Command Prompt - Enter the Cmd to Open Folder - Folde Opened

Extra: How to Stop, Start, and Restart a Service with Command Prompt

As we mentioned, there are hundreds of things you can do with Command Prompt rather than using the UI. One of them is managing your services. You can learn how by following our dedicated guide here.

Extra: How to Run Windows Defender from the Command Line

You can also run Windows Defender from Command Prompt, updating it, performing scans, and more. Follow our existing tutorial to find out how.