How to open a file from command prompt

Who I am
Matthew M. White
@matthewmwhite
Author and references

There are a lot of things you can do in Command Prompt on Windows 10. Nevertheless, it is one of the most underused applications; some users never even open it. The command prompt interface can look a bit intimidating due to the command lines, specific syntax/code, and lack of a clickable GUI.

However, there is nothing to worry about, entering the wrong code/command won't mess up your PC, the command just won't run. You should know that some actions are much faster via the Command Prompt – accessing files, for example.



This article will explain all the commands needed to open a file, close it, open a folder and move to a folder

Open a file

To directly access a file, the command prompt asks you to enter the specific path. This means that you have to enter the file name and its respective extension. Follow these steps:

  1. Taper « Cmd Â» in Windows search and click on the app in the results to run it.

  2. Navigate to the location of your file by typing the following in the Command Prompt window: Users »Username » > cd C: »Users »Username » »Location » iIn this example, the " Username " will be the user and the " Site " will be the office.

  3. Then enter the name and extension of the file you are trying to open: "Filename.filetypee. » In this example, the " File name " will be a screenshot and the " File type " sera .png


Closing a file

The command to close a file is even simpler and follows this syntax: taskkill /im "filename.filetype" /t. The example File type in this command will be "i_view64" and the Filletsau will be “.exe”


This command closes all open files, even if they are running in different applications like Microsoft Word or IrfanView. You should therefore use it with care, to avoid losing your progress or data.

How to open a file

This command to open a folder follows this syntax: start folder path %windir%explorer.exe. Here is an example of the exact path: start %windir%explorer.exe « C:UsersLelaDesktop" page (in French).

It is important to note that the commands for opening files and folders work without administrator rights. You must enclose the file or folder path in quotes as they have specific names with spaces in between. On the other hand, if there are no spaces in the names, the commands run without the double quotes.

Note: For grammatical reasons, some code samples in this article have a period at the end of the sentence. When using the command, omit the period.


Run basic programs

As mentioned, you can run any program with simple commands and for it to work you may need administrative privileges. The syntax for running basic programs is: start program_name. Here is the list of commands that you might find useful:

  1. start calculation (Calculator)
  2. start notepad
  3. start explorer (File Explorer)
  4. start cmd (new command prompt window)
  5. start wmplayer (Windows Media Player)
  6. start mspaint (paint)
  7. start taskmgr (Task Manager)
  8. start charmap (Character)

Press Enter when typing the command and the given program should appear in a moment. You need to make sure there is a space between the "start" part and the program name, but even so some applications may not run. This usually means that their folder is not in the command prompt search path.


Command/Path-EndThisArticle

Ultimately, opening a file through the command prompt is much faster than browsing through all the folders on your computer. You need to know the exact path/location of the file, but you can easily find it with File Explorer on your computer. Do you have any experience, tips, or questions about opening files using the command prompt? Leave them in the comment section below.

Audio Video How to open a file from command prompt
add a comment of How to open a file from command prompt
Comment sent successfully! We will review it in the next few hours.