How to open a file or folder from Command Prompt

In some situations, while you are working in Command Prompt or PowerShell , you will need to open folders or files . If you know how to do it directly from the command line, you won’t have to leave the CMD window .

The graphical user interface of Windows 10 allows us to do almost anything just by clicking on items on the screen. Without it, we would be forced to do everything from the command line in the Command Prompt or in PowerShell, which for many would be a nightmare.

– Advertising –

However, knowing the basic operations like going to a folder, deleting, opening or viewing the contents of a file, etc. it is a very useful skill. In this way you will have quick access to functions and operations from the same CMD.

Open folders and files with Command Prompt and PowerShell

In this guide we will see how to open folders directly from the Command Prompt and PowerShell on your Windows 10 computer. We will cover the following points:

  • How to go to a folder in CMD and PowerShell.
  • How to open a folder in CMD and PowerShell.
  • How to close a file in CMD and PowerShell.

1. How to navigate or go to a folder in CMD and PowerShell

Open the Command Prompt by typing cmd  in the Start menu and selecting it from the results. For PowerShell, you can also find and open it from the Start menu.

Type the following command and press ENTER to execute it:

cd path \ to \ folder

Replace  path \ to \ folder  with the actual path to the folder you want to open. So, it can become:

– Advertising –

cd C: \ Users \ <username> \ Desktop \ folder

To open a file contained in that folder, enter the file name as follows and press ENTER :

path \ to \ folder file-name.extension

Alternatively, you can enter the full path to the file without using the cd command  . For instance:

C: \ Users \ <user name> \ Desktop \ folder \ file-name.ext

Open a folder with Command Prompt and PowerShell

The above procedure allows you to open a file saved in a folder from CMD. However, if you want to open the folder in Windows Explorer from CMD or PowerShell, you will need to do so as follows.

In Command Prompt

To open a folder, add the folder path after the start command  . For example, I can navigate to the TEST folder on my desktop with the following command:

start C: \ Users \ <username> \ Desktop \ TEST

If I want to open the current folder, I run the start command  with a period ( . ):


To open the folder containing the current folder, we use a colon ( .. ):

start ..

In each of these cases, pressing ENTER the specified folder will open a Windows Explorer window.

In PowerShell

To open a folder in Windows Explorer from PowerShell, enter any of the following commands:




and add the folder path.

ii C: \ Users \ <user name> \ Desktop \ folder-name

To open the current directory, use the following command:


Close a file using Command Prompt and PowerShell

To close a file already opened using CMD, we will use the taskkill command . First, navigate to the folder using the first method:

cd path \ to \ folder

Enter the following command when you are in the correct directory:

taskkill / im file-name.ext / t

Replace the file- name.ext part  with the name of the file you want to close.

Remember that this command instantly closes the open file, so if you are not careful you could lose unsaved data.

by Abdullah Sam
I’m a teacher, researcher and writer. I write about study subjects to improve the learning of college and university students. I write top Quality study notes Mostly, Tech, Games, Education, And Solutions/Tips and Tricks. I am a person who helps students to acquire knowledge, competence or virtue.

Leave a Comment