categories
Updated on in

How to install software using cmd

Author: Adetayo Sogbesan
Adetayo Sogbesan Article author

Today, there are multiple guides on how to install software on a remote computer using cmd. One of the quickest routes is by running commands directly on the system’s command prompt.

This method is a useful alternative if you want to deploy several apps simultaneously, avoid running a standard GUI-based installation wizard, or install software on a remote computer in your network without user interaction.

In this guide, we’ve compiled all the information you’ll need to install software through cmd successfully.

Getting ready to install software from the command line

Before you begin the cmd procedure to install software, it’s important you have everything you need to make the installation a success. To do so, here’s a short list we’ve compiled to help you remotely install software cmd efficiently:

  • Administrator privileges: Log in as an administrator; else, have the administrator account password on the target remote PC if it’s not in the same domain.
  • Installation packages: Download .msi files of all the applications you want to install and then write down the full path to their location.
  • Firewall settings: Ensure that the firewall on the remote computer does not block “File and Printer sharing” traffic on port TCP 445.

Install from cmd on a local machine

Here’s a brief breakdown of how to install software with cmd:

  1. Open the Start menu and type “cmd.exe.”
  2. Next, right-click “cmd.exe” from the “Programs” list, then proceed to click “Run as administrator.”Alternatively, you can click on Command Prompt and choose Run as administrator from the right-side tab
  3. After that, type the full path to the file’s directory after the “cd” command. For example, \cd C:\users\admin\desktop.
  4. Type this command and then press “Enter”:

msiexec filename.msi

Where “filename.msi” is the name of your file.

For example, to install HelpWire you need to type msiexec HelpWire.msi

Install software remotely using cmd

To remotely install software using cmd, follow these steps:

  1. Open a command prompt as an administrator;
  2. Copy the MSI package on the remote computer using this command: copy c:\users\username\downloads\APP.msi \\ENDUSER-PC\C$

    Here, “APP.msi” is the name of your installation package, and “ENDUSER-PC” is the remote computer’s name.

    Administrator Command Prompt

    Furthermore, you can also use the remote computer IP address rather than the computer name.

  3. When in the command prompt, change the current directory to “C:\SysInternals” with the following command (you may need to download Windows Sysinternals Tools first):cd c:\SysInternals
  4. Then, run the following command to start installing the app on the remote computer:PsExec.exe \\ENDUSER-PC\ -i -s msiexec.exe /i "c:\APP.msi" /qn /norestart

    In this example, the command will install Helpwire on a computer named Work Laptop

The PSExec command will launch the .msi installer on the remote computer. This, in turn, will install your app in quiet mode (/qn) without user interaction.

Using cmd Windows Package Manager (winget)

With the Windows Package Manager, you can easily research, download, install, update, and remove apps on Windows 11 or 10 installations with Command Prompt. This command-line tool reduces the number of steps it would have taken using a different method.

Single app installation via winget:

  1. Open the Start menu.
  2. Search for Command Prompt, then right-click the top result.
  3. From the menu pane, select the Run as administrator option.
  4. Then, type the following command to install an app with the winget command and press Enter:

winget install "APP-NAME"

Remember to change “APP-NAME” for your actual app’s name. In addition, you only need quotation marks when the name consists of multiple words with spaces. For example, to install HelpWire, the command will be widget install HelpWire.

In this case, after you press Enter, the installation of HelpWire will immediately start.

Multiple apps installation:

  1. Click on Start.
  2. Search for the Command Prompt.
  3. Next, right-click on the top result to select Run as administrator option.
  4. Type this command to install multiple apps with the winget command and press Enter:
  5. winget install “APP-NAME-1” -e && winget install “APP-NAME-2” -e
  6. The next step is optional: Type the following command to install multiple apps by ID and press Enter:
  7. winget install –id=APP-NAME-1 -e && winget install –id=APP-NAME-2 -e

When in the commands, remember to change the “APP-NAME-1” and “APP-NAME-2” for the names of the apps you’re installing. If you need to process more app installations, simply add a space and && along with the app installation command.

This example installs the VLC and Visual Studio Code apps

Install software via cmd on multiple remote machines using WMIC

WMIC (Windows Management Instrumentation Command-Line) is a potent tool that allows you to remotely install software cmd easily. Unfortunately, the tool doesn’t see much use due to a lack of easily accessible documentation.

In this section, we’ll extensively examine the most straightforward method: an MSI installation file that requires no options to be located on each remote user’s local drive. Let’s dive right in.

  1. Load up the command shell with the appropriate access permissions: Runas /user:DomainAdminAccount@DOMAIN cmd

    … these permissions will prompt us for the credentials of our DomainAdminAccount. Once authentication is complete, we’ll be handed a command shell that runs as the Admin.

  2. Next, step into WMIC by entering the following command: u: \>wmic

    wmic:root.cli>

    (We could have easily jumped into WMIC directly from the run-as command… this just helps us to break out the steps)

  3. Call the installation for a list of machines using the WMIC’s ability to handle a flat text file as input. These inputs allow the nodes to run installations on a list of machines (in our earlier example, it’s stored on the admin’s local hard drive in C:\computers.txt) by running the following command:/node::@c:\computers.txt product call install true,",c:\PathToYour\File.msi

    This command will iterate through the list in computers.txt… and skip over invalid nodes (e.g., the machine is turned off). After that, it’ll ask for an installation confirmation for each machine.