How to open a program using the command line. How to run a program from the command line. Installing the program from the command line. Installing the program via the command line

Team START allows you to run applications in a separate window, with the ability to specify some parameters for their execution.

Command line format:

START ["header"] [command/program] [parameters]

Command line options:

"heading"- window title. Must be in double quotes.

path- working directory.

B- launching the application without creating a new window and disabling processing of the CTRL+C key combination. If an application does not handle CTRL+C on its own, the only way to break it is to use CTRL+Break.

I- The new environment will be the original environment passed to cmd.exe, not the current environment.

MIN- Run a command/program in a minimized window.

MAX- Launch a command/program in a maximized window.

SEPARATE- Run a 16-bit Windows program in a separate memory area.

SHARED- Running a 16-bit Windows program in a shared memory area.

LOW- Launch the application with IDLE priority (lowest priority).

NORMAL- Launch the application with NORMAL priority.

HIGH- Launch the application with priority HIGH.

REALTIME- Launch the application with priority REALTIME (highest priority).

WAIT- Launching an application and waiting for it to complete.

ABOVENORMAL- Launching an application with priority class ABOVENORMAL (higher than standard)

BELOWNORMAL- Launching an application with a BELOWNORMAL priority class (lower than standard)

team/program- If this is an internal cmd.exe command or a batch file, the command processor (cmd.exe) is launched with the /K switch. This means that the window will not be closed after the command completes. If it is not a cmd.exe internal command or a batch file, then it is a program that will be launched in a graphics or text window.

options- Parameters passed to the command/program.

To call non-executable files through the file type mapping mechanism, simply enter the file name on the command line. For example, the command

START MYFILE.TXT

Will launch a text editor NOTEPAD with opening the MYFILE.TXT file.

When running a 32-bit GUI application, the CMD.EXE command processor does not wait for the application to exit before returning to the command prompt. This new behavior does NOT apply to running applications from batch files.

When you execute a command line whose first element is the text string "CMD" without a filename extension or path specified, it is replaced with the value of the COMSPEC variable. This prevents CMD.EXE from running from the current active folder, if there is one there.

If the first command line item does not contain a filename extension, the CMD.EXE command processor uses the value of the PATHEXT environment variable to determine the name extensions of executable files and how to search for the desired file. By default, the PATHEXT variable is set to:

COM;.EXE;.BAT;.CMD

Note that this syntax is similar to the syntax for the PATH variable, that is, individual elements are separated by semicolons.

If the search for an executable file does not match any of the extensions, a match is made to the specified folder name. If the folder name matches the one specified, then the START command runs EXPLORER for that path. If this action is performed from the command line, it is equivalent to running the CD /D command on the specified path. So, for example, the command

start C:\windows

Opens the C:\windows folder in an Explorer window.

Examples of using:

start /?- issue a certificate about the use of the command.

start- when launched without parameters, a new CMD command interpreter window will open.

start "My new CMD window"- as in the previous case, CMD will be launched in a new window, but text will be displayed as the window title My new CMD window

start devmgmt.msc- the extension will be launched .msc Windows Device Manager.

start http://google.com- the Internet browser will launch and the Google search engine page will open.

start mailto: [email protected] - the mail client will be launched in the mode of preparing an email for the address [email protected] .

start /min notepad.exe- Notepad will be launched in a minimized window.

start "Backup Files" /min /belownormal mybackup.bat- launching a command file in a minimized window with a lower priority.

start /abovenormal /MAX winword.exe- launching the Microsoft Word editor in a new window, maximized to full screen and with higher priority.

start "" /high /MAX "C:\Program Files\Good game\MyGame"- launching the program MyGame with high priority.

Priority management is convenient to use to ensure comfortable user experience with interactive applications while performing lengthy calculation tasks. So, for example, equal priorities of the MS Word editor and a computational task that consumes a significant share of the CPU resources can result in freezing when working with a text document. Reducing the priority of the calculation task will create normal conditions for the user’s work against the background of her work.

Please note that the window title can be omitted, but the peculiarity of processing input parameters by the command start may cause unexpected results when attempting to run a program whose name or path contains space(s). For example, if you try to run the following command:

start "C:\Program Files\FAR\FAR.EXE"

Due to the presence of a space in the path to the executable file, the line to run FAR.EXE must be enclosed in double quotes, however the format of the input parameters for start assumes the presence of a window title, also enclosed in double quotes, as a result of which "C:\Program Files\FAR\FAR.EXE" is interpreted not as an executable program, but as a window title - the interpreter will be launched CMD with the window title "C:\Program Files\FAR\FAR.EXE" . To prevent this from happening, you need to use any header, even empty:

start "" "C:\Program Files\FAR\FAR.EXE"

When running batch files using the command start, the command interpreter window (cmd.exe) is launched with the parameter /K, i.e., after executing the commands in the batch file, cmd.exe does not terminate. For example, there is a batch file test.bat the following content:

ECHO TEST

When running it with the command start test.bat will be fulfilled echo and the shell window will remain open, waiting for user input. This fact must be taken into account when using the command start in scenarios that are executed automatically without human operator intervention. To close a window CMD After executing the batch file, just add the command to the end of it EXIT.

Perhaps nothing affects the security of a system more than the user of the system itself, and sometimes administrators have to fight not so much with enemy Trojans as with a simple user. For these purposes, accounts with certain rights are used; created a group, assigned rules, added users and that’s it – let them enjoy the Start button and the scarf.

The same situation is with the Internet, if you surf as an admin on the world wide web, then no matter how, there will be an evil virus that will penetrate the system and want to run the program from the command line for further dirty tricks, and for control, it will register in the registry. Another thing is a limited account - you can’t do much with it. But even in this case, you have to make exceptions - for example, you need to run a program through the command line not under your own account, but under another account (with greater rights), or simply launch programs with additional parameters. For these purposes, two command line utilities will be considered - RUNAS(running a program via the command line under a different account without logging out) and START(run the program from the command line with additional parameters). Remember that to perform similar actions, the script server provides methods and .

START utility - command line

This utility provides a number of additional parameters:

  • launching programs in a certain mode;
  • open a browsing window for a given directory (folder);
  • open documents whose type is registered in Windows (that is, it is specified which application should open a document with a given extension).

And so, let's get acquainted with the basic syntax of this utility:

START ["header"] [command/program] [parameters]

Provided the command/program defines an internal command line command ( DIR, COPY...) or a batch file, then to launch them in a new window (provided that the key is not specified /IN) the program starts automatically CMD.EXE from the command line with the switch /K. Under this condition, the new window will not be closed after the command is executed. Provided that it is not an internal CMD utility or a batch file that is being executed, then this program runs in a graphical or text window.

Provided that the first element of the command shell is the word CMD without extension and file path, the command processor will replace it with the value of the variable COMSPEC(full path to the command interpreter). If the first element is the name of the program being executed without an extension, then the value of the environment variable will be used RATNECHT, this will make it possible to determine the name extensions of executable Files and the search order for the desired file. Typically, the RATNEXT variable contains the following values:

RATNEXT=.COM;.EXE;.BAT;.CMD

Provided that no file with the default extensions is found, the command interpreter will check whether the given name matches the directory name. If so, then START utility will launch Explorer and open the specified directory in it.

"heading"– defines the title of the created window. For example:

START "Copying data" copyer.bat

/path– this parameter specifies the working directory when opening a new command window.

/I– this key says that the new operating environment will be the original environment passed by the cmd.exe command interpreter, and not the current command window environment.

/MIN– this parameter says that the command/program is launched via the command line in a minimized form, but if /MAX is used, then in a maximized (maximized) window.

/SEPARATE– execution of a 16-bit application in a separate memory area

/SHARED- execution of a 16-bit application in a shared memory area

Keys /LOW | /NORMAL | /HIGH | /REALTIME| /ABOVENORMAL | /BELOWNORMAL set the priority of the task to be launched.

/WAIT– run the program from the command line and wait for it to finish

/IN- execution occurs without creating a new window (of course, if this is possible). Thus, if the cmd.exe internal command or batch file is run with this switch, a new copy of the command interpreter will be launched in the current command window.

Examples of using the START utility:

You need to run Microsoft Word from a command prompt window as the main process and automatically open the two specified files (the name of one of the files contains a space, so it is in quotes):

START /MAX winword.exe "My document.doc" docum.doc

Opening a browser window for the My Documents directory on the current drive:

START "My documents"

Opening a browser window for the current directory:

Opening the My Favorite Document.doc file from the My Documents folder in a standard window:

START "C:\My Documents\My Favorite Document.doc"

RUNAS command line utility

RUNAS utility The command line does not contain complex syntax, and is quite simple to use. It allows you to run a program via the command line as another user without terminating the current session. Typically, it is used by administrators to perform minor system commands. For example:

runas/user: [email protected] regedit.com

runas /user:dataAdmin regedit.exe

Naturally, if you need to run an application under another user who has more authority and has a password, then of course you need to know the password, there’s no way without it:

runas/user: [email protected] regedit.exe
Enter password for [email protected]:
Attempting to start “regedit.exe” as user
"[email protected]"...

Command in Command Prompt Window Runas/? provides detailed help on additional options for this utility.

Often, for various programs, it is necessary to specify special command line parameters that must be activated when the program is launched. For example, in the QIP program, in order not to be bothered by unnecessary services, you must specify the “/isolated” key in the parameters. How to do it?

By the way, I personally always use this key in QIP - it turns the program into the good old QIP that it once was, without a crowd of annoying services and all sorts of rubbish. All that remains is “ICQ” itself.

Well, we digress. Running the program with command line parameters is easy. To do this, you must first create a shortcut for it on the desktop or in the taskbar.

Click on the program icon in the folder Program Files or in the list All programs right click and select command Send to > Desktop (create shortcut).

The shortcut will appear on the desktop. Right click on it and select command Properties. A window will open in which we are interested in the field An object. It is there, after the quotes, that we should add the command we need. In this case, the key is “/isolated”.

However, this method seems somewhat labor-intensive to me. Create a shortcut, then enter parameters... wouldn’t it be easier to be able to immediately launch any program by specifying the necessary command line parameters in the context menu? In other words, you just right-clicked on the file, specified the necessary parameters, and it was done.

The ExecParm program will help us with this.

Command line options with ExecParm

First, download the program for the system of the required capacity.

Download a regular archive, which you can unpack anywhere. It will contain only three files – ExecParm.txt, Execparm.dll and Execparm.inf.

Where is the executable file, you ask, how to install it? Very simple. Just right-click on the Execparm.inf file and select the command Install.

In essence, this simply adds a few entries to the system registry. Now just right-click on the program executable file and select the command Execute With Parameters(i.e. run with command line parameters).

All that remains is to specify the necessary parameters and click on the OK button. Perhaps someone will like this method more than the first, more traditional option.

It's no secret that Linux users always turn up their noses at those who work on Windows. They say that for Windows you need to install the application for at least 10 minutes, pressing a large number of buttons, fiddling with selection checkboxes. And before you actually install the application, you need to find the official website of the program without getting lost on the Internet. Linux users are proud that any utility
can install from the terminal by running a certain command.

In Windows, like in Linux, it is possible to install, remove or edit programs using commands.

The developers claim that Windows 10 will also offer the ability to quickly install, update, and remove various software from the system terminal. We just have to wait for the official release. But you don’t have to wait for the release, but right now take advantage of an amazing feature that will allow the user to install the program from the command line. However, this is not all the surprises: the utility will also allow you to delete, update, open and close the program. Interesting? Let's get to know Chocolatey better.

Installing the program via the command line

Now we will try to manage programs in a more convenient way and very similar to how it is done in the Linux environment. And a special service called Chocolatey, a package manager for Windows, will help us with this. The Chocolatey client is a utility designed to run in the console. Let's try to install it right away. To install, open a terminal with administrator rights. Right-click on the Start menu and click on Command Prompt (with administrator rights). Now let's copy the following code:


Paste it in and press the Enter key. Now you need to close the console so that the data on the variables is refreshed.

The Chocolatey service has a large catalog of utilities and applications: currently more than 2000 utilities. You can view them on the official website https://chocolatey.org/packages. So, it's time to learn how to install any program via the command line:

Open the terminal again as administrator. We copy the text presented to the right of the program on the website https://chocolatey.org/packages. For example, to install the Google Chrome browser, the following code is provided:


Copy it and paste it into the terminal. Don’t forget to write the combination -y after the code from the site. Press Enter. Now all that remains is to wait for the browser installation to complete. After which you can close the terminal window.

As you can see, the Google Chrome browser installed very quickly. We didn't have to click any buttons or select a location to save the files (disk C is used by default). By the way, novice users can make a set of their favorite applications in a notepad, so as not to go to the Chocolatey service every time. To uninstall a program via the command line, enter the code uninstall, then the name of the program. For example, choco unistall ccleaner.

ATTENTION. The service only works with packages that are installed through it. That is, if any software is not available for installation through Chocolatey, then you will not be able to remove it this way.

How to run or uninstall a program via the command line

Now let's look at a method that allows through the command line. This can be done in three very simple steps. Let's get started:

  1. Open a terminal of the Windows operating system.
  2. In the window that appears, write the full path to the location of the application launch file. For example, D:/Files/chrome.exe
  3. We press Enter and wait for the system to open what we need.

It's time to learn how to close a program via the command line. For this we need additional taskkill software. Let's start:



Let's sum it up

Today we looked at what seemed, at first glance, to be a complex topic. But now you know that you can very easily install or uninstall some programs through the command line using the Chocolatey service. And you also know how to open or close an application through the same terminal. We hope that you managed to do everything correctly and that there are no questions left on the topic.

c:\archive\arch.rar - path to the archive file

"c:\MyFiles\" - path to the folder prepared for archiving. Please note that paths to folders that contain at least one Cyrillic character or a space in the name must be enclosed in quotation marks.

Dear friends, it’s no secret that Linux users always turn up their noses at those who work on Windows. They say that for Windows you need to install the application for at least 10 minutes, pressing a large number of buttons, fiddling with selection checkboxes. And before you actually install the application, you need to find the official website of the program without getting lost on the Internet. Linux users are proud that they can install any utility from the terminal by executing a certain command.

In Windows, like in Linux, it is possible to install, remove or edit programs using commands.

The developers claim that Windows 10 will also offer the ability to quickly install, update, and remove various software from the system terminal. We just have to wait for the official release. But you don’t have to wait for the release, but right now take advantage of an amazing feature that will allow the user to install the program from the command line. However, this is not all the surprises: the utility will also allow you to delete, update, open and close the program. Interesting? Let's get to know Chocolatey better.

Installing the program via the command line

Now we will try to manage programs in a more convenient way and very similar to how it is done in the Linux environment. And a special service called Chocolatey, a package manager for Windows, will help us with this. The Chocolatey client is a utility designed to run in the console. Let's try to install it right away. To install, open a terminal with administrator rights. Right-click on the Start menu and click on Command Prompt (with administrator rights). Now let's copy the following code:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE% \chocolatey\bin

Paste it in and press the Enter key. Now you need to close the console so that the data on the variables is refreshed.

The Chocolatey service has a large catalog of utilities and applications: currently more than 2000 utilities. You can view them on the official website https://chocolatey.org/packages. So, it's time to learn how to install any program via the command line:

Open the terminal again as administrator. We copy the text presented to the right of the program on the website https://chocolatey.org/packages. For example, to install the Google Chrome browser, the following code is provided:

choco install googlechrome -y

Copy it and paste it into the terminal. Don’t forget to write the combination -y after the code from the site. Press Enter. Now all you have to do is wait for the browser installation to complete. After which you can close the terminal window.