Users of the Windows operating system are used to running all programs by double-clicking their icons with the left mouse button. However, few people know that the same action can be performed in the system console. This article will talk about how to run program c through the command line. In total, we consider three methods. In the end, we will provide a method that allows you to run the program through a shortcut, but with console parameters.
Method 1: launch the system application
First of all, we will tell you how to run a program from the command line, if it is a system one. Perhaps this is the easiest method, because to execute it you need to know only one command - start. And, of course, the name of the application itself. The most popular system programs will be listed below:
Command line (a second window will open at startup)
As a result, to start a specific program you need to write the word start and enter its name through a space. In practice, it looks like this:
Method 2: specify the full path to the file
Unfortunately, starting the program from a third-party developer in the previous way will not work, but there is another method. It consists in entering the full path to the executable file. For example, you have on the C system drive the installer of some program called install.exe. To start it, you will need to enter the following command:
Accordingly, if the file will be located in another folder, then in the line you need to enter all the directories that follow before the file. By the way, it is very important that there are no spaces in the folder name. Otherwise, an error will appear. Eliminating it is quite simple - you need to quote all the way. For example:
Method 3: using path
The third way to start the program from the command line is to use the patch command. Its essence is to remember the specified directory. That is, you need to enter the address not to the file itself, but to the folder where it is located. For example, you need to open Total Commander, which is located at the following address:
Then in the console, enter the following command:
The command line will remember the directory you specified and will run all the files from it if you enter their name. Thus, to launch Total Commander it remains only to write its name:
How to run a program with command line options?
Now we’ll go directly to how to run the application with console parameters. By the way, this is done quite simply, you don’t even have to open the command line - everything is done in the properties of the shortcut.
- Right click on the program shortcut.
- Select "Properties."
- Click the Shortcut tab.
- In the "Object" field, add the desired parameter after the quotation marks.
- Click apply and close the window.
Now the program will start with the specified parameter, you just need to double-click on its shortcut. So we examined all the ways how you can run the program from the command line. Well, which one to use is up to you.
1 way: launching a system application
In order to start one of the system applications from the console, the “start” command is used and the desired name is indicated with a space. As the name you need to register the system name. For Explorer, this is explorer, task manager is taskmgr, control panel is control, system configuration is msconfig.
To open notepad, write notepad, Windows Media Player - wmplayer, Paint - mspaint, character table - charmap. If you type cmd, a new command window opens.
For example, open the symbol table. Type in the line:
and press enter.
2 way: specifying the full path to the file
If you need to run any other installed application, then you should specify the full path to the executable file of the program.
For example, I have a program for installing a movie studio in the Downloads folder, let's open it. I go into the folder and click on the field where the path is registered. All this line must be written on the command line (since copy-paste does not work there) and at the end add the name of the utility that we want to run.
The console will read:
After pressing “Enter”, preparations for the installation of the film studio began. As you can see, when writing a path, it is not necessary to use capital letters, only small letters can be entered.
If there are spaces in the path to the desired file, then a window will appear with a message that the specified file cannot be found. The fact is that the command line recognizes the path to the first space, and not the entire line you entered. In the example, she decided that I want to open c: program.
Now let's step back a little from the topic, and consider how to find out the full path to the program that we want to run.
To do this, find the executable file of the desired application through the Explorer window. To understand that it is he, look that in front of him in the field "Type" the word "Application" was indicated. Then click on the field at the top - this is the way.
For example, the Total Commander is launched by the file "totalcmd", and it is located on the path: "c: program files total commander".
Or another option. If on the desktop there is a shortcut of the desired application, you can not search for it through Explorer. It is enough to right-click on it and select "File Location".
A window will open, which we have already examined. It will highlight the file that launches the utility, and at the top you can find the path to it.
3 way: using path
With this command, we save the path to the folder in which the executable file is located, and then run it.
Consider the same Total Commander. In the console we write:
path c: program files total commander
After the "path" be sure to put a space. This is the path to the “totalcmd” file we need. Press Enter.
Next, write the name of the exe-file. I have this:
The specified program will be launched. An extension is optional at the end. Thus, you can run any executable file in the specified folder.
4 way: using the cd command
This command will open the specified folder, and from it we will start the file we need. For example, let's go to the TeamViewer daddy:
cd c: program files teamviewer
After "cd" put a space. Press "Enter".
This file contains the file that runs TeamViewer, it has the same name. Therefore, I introduce further:
I press "Enter" and the utility starts.
If you need to open an application that is not installed on the system drive, you can use the path command. If I type:
path d: program files ccleaner
(after entering each line, press "Enter"), then CCleaner will open for me. It is he installed on the specified path on the D: drive.
But with the help of the cd command this will not work.
5 way: through the context menu
To do this, find the folder in which the executable file is stored, and right-click on it, while holding down the Shift key. Next, in the context menu, select "Open Command Window".
After that, the required folder will immediately open on the command line. Enter in the line the name of the file that launches the utility, and press "Enter". We launched CCleaner, which is not located on the system drive (I have D:).
If you need to run a program that is installed in the same place as the operating system, the steps are the same. Let's open the Google Chrome browser. We find the folder in which the file is stored, that launches it, and select the item mentioned above.
Then enter the name of the file with the extension. * Exe: chrome, and press "Enter". The browser will be launched.
6 way: path in quotation marks
At the beginning, I mentioned that if there are spaces in the prescribed path, the file will not open. But if you write it in quotation marks, then the console will understand everything. Quotation marks must be double and straight, not commas. They are set using the “Shift + E” combination with the selected English keyboard layout.
In them, you need to write the full path and at the end specify the file itself with the extension that will be launched:
"C: program files total commander totalcmd.exe"
Using quotation marks, you can open programs on both the system disk and the data disk.
These are all the ways I know that will help you open the program you need directly from the Windows command prompt. If you know anything else, write in the comments.
How to run a program through the command line
We used to run programs and applications with the usual double-click of the left mouse button on a shortcut or an executable file. But sometimes it may be necessary to run the program through the command line, for example, when restoring the system.
How to start a system application through the command line?
Open a command line that can be launched through the Start menu Start -All programs - Accessories - Command line or using the Run tool, entering CMD into the line.
Starting programs using the command line is performed using the START command. An example of starting notepad through the command line:
After you press Enter, the Notepad window appears. In the same way, you can run explorer, Control Panel, system configuration program (msconfig) and other system utilities and programs.
However, only system applications are not always satisfied with the user; very often it is required to run a specific program installed in the system.
How to start any application using the command line?
The launch of any application is possible with the full path to the executable file. However, if you try to specify the path explicitly to the START command, for example, to the Opera Internet browser, then you will not succeed:
start c: Program Files (x86) Operaopera.exe
Executing such a command will result in an error because the start command does not recognize the specified path. A command can recognize the path to the program only if there are no spaces in it. In this case, before starting the application, this path must be saved. For these purposes, the PATH command exists.
Type the following command at a command prompt:
path c: Program Files (x86) Opera
This will allow the program to save the path to the specified folder and use it when starting any application that will be inside this folder.
will allow the user to start a web browser. Please note that in this case it is not necessary to specify the file permission; the command will recognize it automatically. If there are other executable files inside the folder, they can also be launched in this way.