How To Open A Program From The Command Line

Table of contents:

How To Open A Program From The Command Line
How To Open A Program From The Command Line

Video: How To Open A Program From The Command Line

Video: How To Open A Program From The Command Line
Video: How to open any program or application using command prompt 2024, December
Anonim

In the Windows operating system, programs are usually opened through the All Programs menu item, using the application shortcut on the desktop, or directly from the program folder by clicking on the executable file. But in Windows, there is another way to open programs - through the command line.

How to open a program from the command line
How to open a program from the command line

Instructions

Step 1

To open the Command Prompt (Console), navigate to: Start - All Programs - Accessories - Command Prompt. A black (by default) window will open, this is the command line. To open programs included in the Windows operating system, just type the name of the program in the command line and press Enter. You don't even need to include the file extension. For example, type notepad at the command line and press Enter to launch Notepad.

Step 2

If you want to open a third-party program, you must specify the full path to its executable file. For example, if you have the Total Commander file manager installed on your computer and the operating system is on the C drive, enter the following into the command line: "C: / Program Files / Total Commander / Totalcmd.exe" and press Enter.

Step 3

Note that the path is enclosed in quotation marks. This should be done if there are gaps in the path. In this case, there are two spaces, that is, spaces between words, in Program Files and Total Commander. Also, take a closer look at the quotes themselves - they should be "straight", not commas. If you enter the wrong quotes, the program will not open. Enter quotation marks directly in the command line window, and do not copy them through the clipboard. The necessary quotes, in the English layout, will be obtained by pressing Shift + E.

Step 4

You can run the program from the command line by going directly to the directory with the program, in this case you do not have to enter the path string. For example, you need to run the same Total Commander. After starting the command line, enter: cd c: / Program Files / Total Commander. Without a dot at the end, of course. After pressing Enter, you will find yourself in the Total Commander directory. Now enter Totalcmd.exe, Total Commander will start.

Step 5

In the command line, you can not only run programs, but also close them, the taskkill command is used for this. It is most convenient to close a program by its PID-identifier number. Type tasklist command in the command line, you will see a list of processes and their IDs. Let's say you need to close Notepad. Find the notepad.exe process and remember its identifier - let it be 3900 (your identifier will be different). Now type to the command line: taskkill / pid 3900 / f and hitting Enter. Notepad will be closed. The f parameter in the command specifies the forced termination of the process.

Recommended: