FeaturedPower ShellScripts

WinGet – Install-upgrade Apps Automatically

WinGet - Install-upgrade Apps Automatically

Windows Package Manager

Microsoft released their Windows Package Manager aka Winget for developers, application packager, application vendors to manage their apps.

Winget help us to discover, install, upgrade, remove any application that we want. winget can be accessed or used via the Windows Terminal, PowerShell, or the Command Prompt.

Install winget

There are several ways to install the winget tool:

 

Administrator considerations

  • When running winget without administrator privileges, some applications may require elevation to install. When the installer runs, Windows will prompt you to elevate. If you choose not to elevate, the application will fail to install.

Use winget

After App Installer is installed, you can run winget by typing ‘winget’ from a Command Prompt.

One of the most common usage scenarios is to search for and install a favorite tool.

  1. To search for a tool, type winget search \<appname>.
  2. After you have confirmed that the tool you want is available, you can install the tool by typing winget install \<appname>. The winget tool will launch the installer and install the application on your PC. winget commandline
  3. In addition to install and search, winget provides a number of other commands that enable you to show details on applications, change sources, and validate packages. To get a complete list of commands, type: winget --helpwinget help

Commands

The current preview of the winget tool supports the following commands.

COMMANDS
Command Description
hash Generates the SHA256 hash for the installer.
help Displays help for the winget tool commands.
install Installs the specified application.
search Searches for an application.
show Displays details for the specified application.
source Adds, removes, and updates the Windows Package Manager repositories accessed by the winget tool.
validate Validates a manifest file for submission to the Windows Package Manager repository.

Supported installer formats

The current preview of the winget tool supports the following types of installers.

  • EXE
  • MSIX
  • MSI

Scripting winget

You can author batch scripts and powershell scripts to install multiple applications.

CMD
@echo off  
Echo Install Powertoys and Terminal  
REM Powertoys  
winget install Microsoft.Powertoys  
if %ERRORLEVEL% EQU 0 Echo Powertoys installed successfully.  
REM Terminal  
winget install Microsoft.WindowsTerminal  
if %ERRORLEVEL% EQU 0 Echo Terminal installed successfully.   %ERRORLEVEL%

 Note

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.

 

Get more info on WinGet from Microsoft Documentations :

https://docs.microsoft.com/en-us/windows/package-manager/

Show More

Related Articles

Back to top button