Batch Install Softwares Using Winget and Scripts

Here is how you can Batch Install Multiple Softwares Using Winget and Batch Scripts

Microsoft has its very own Windows Store based on the same idea – a central hub for all your Windows applications. It was introduced in 2012 and has improved considerably, now also being the source of updates for many Windows applications. However, it never really took off the way Microsoft intended it to. Instead, people still relied on other software repositories (package manager) which allowed them to quickly download software from the terminal. Package managers like Chocolatey, Ninite, Scoop, and more.

One big flaw with Windows Store is that it only relies on a GUI and doesn’t allow users to use scripting, a core automation functionality that has always been one of the big advantages of having a PC.

Now, Microsoft has finally decided to release its very own Package Manager called winget which is a command-line package manager that allows you to quickly download an application from a wide range of Windows applications. Not only does it allow you to install your favorite tools and utilities from the command-line, but it also supports scripting functionality.

The feature isn’t currently available for the public and is only available as a preview for Windows Insiders. However, you can still use it by using our guide on installing Winget. Furthermore, to find out how you can use it to find and install applications, you can use our guide over here.

This is the third part of our guide on using Winget which will cover the scripting basics you can use to automate the process of installing tools through a simple script, without having to manually download and install tools.

How-To Write a Script for Installing Multiple Tools Using Winget

Winget has support for both, batch scripts as well as PowerShell scripts, allowing you to easily install multiple applications.


When scripted, winget will launch the applications in the specified order. When an installer returns success or failure, winget will launch the next installer. If an installer launches another process, it is possible that it will return to winget prematurely. This will cause winget to install the next installer before the previous installer has completed.


  • Installation
    winget install Microsoft.Powertoys
  • Check Successful Installation
    if %ERRORLEVEL% EQU 0 Echo Powertoys installed successfully.

To learn how batch scripts work and learn multiple commands you can use, you can read our guide on batch scripts over here and automation using batch scripts over here. For this guide, you just need these two commands; the first to install an application and the second to verify if the installation was successful.

Below, we are attaching an example script you can use to install multiple software.

@echo off

Echo Install Powertoys and Terminal

winget install Microsoft.Powertoys

if %ERRORLEVEL% EQU 0 Echo Powertoys installed successfully.

winget install Microsoft.WindowsTerminal

if %ERRORLEVEL% EQU 0 Echo Terminal installed successfully.

You can copy the above script and paste it in a Notepad file and save it as a .BAT file, as shown in the screenshot below. After saving it, you can simply double-click to execute the file or run it using Command Prompt (check our guide)

This will install two softwares; Powertoys and Terminal. The first command, @echo off is to turn off command-line output for the installation process. The second command Echo Install Powertoys and Terminal is to display this output on the screen, you can use it to print anything.

The third command is to start the installation and the fourth command is to check the error state – if the %ERRORLEVEL% variable is zero, then it means that the installation was successful. In any case, the installer will move on to the next line in the script. You can use this procedure to install dozens of applications and output status on the command prompt using the Echo command.