WinGet Automation: Install Free Software Automatically
In this article
Yes, you can automate free software installations with WinGet (Windows Package Manager). WinGet is Microsoft's official command-line tool for installing, upgrading, and managing software on Windows 10 and 11, and it supports scripting and batch operations that let you install multiple applications in one go. This article explains how WinGet works, how to use it for automation, and what to watch out for.
What Is WinGet?
WinGet is a package manager built into modern Windows. It was introduced in 2020 and is now included by default with Windows 10 (version 1809+) and Windows 11. It works by pulling software from a community-maintained repository called the Windows Package Manager Community Repository, which contains thousands of free and open-source applications, as well as some commercial ones.
Think of it like apt on Ubuntu or brew on macOS, but for Windows. Instead of downloading an installer from a website and clicking through a wizard, you type one command and WinGet downloads, verifies, and installs the software for you. Because it's scriptable, you can automate the entire process.
How WinGet Automation Works
Automation with WinGet is built on three core commands: install, upgrade, and export/import. The simplest form is a one-liner:
winget install --id Mozilla.Firefox -e
This installs Firefox. To automate multiple apps, you chain commands in a batch script (.bat) or PowerShell script (.ps1):
winget install --id Google.Chrome -e
winget install --id 7zip.7zip -e
winget install --id VideoLAN.VLC -e
For more robust automation, use the --silent flag to suppress installer prompts, and --accept-package-agreements to accept license terms automatically. A typical silent install looks like:
winget install --id Notepad++.Notepad++ -e --silent --accept-package-agreements
You can also export your entire installed package list and reinstall it on another machine:
winget export -o apps.json
winget import -i apps.json
This is especially useful for setting up a new PC or restoring a development environment.
Finding the Right Package ID
Before automating, you need the exact package ID. The search command finds it:
winget search "visual studio code"
Output shows the ID, version, and source. Use the ID in your scripts. For example, Microsoft.VisualStudioCode is the ID for VS Code. Always verify the ID matches the publisher you expect—typos or look-alike names can install the wrong software.
Common Problems and Solutions
WinGet isn't perfect. Here are frequent issues and fixes:
- Installer requires elevation: Some apps need admin rights. Run your script from an elevated PowerShell or Command Prompt (right-click → Run as administrator).
- Package not found: Not every app is in the repository. Check if the publisher offers a direct download or use a different source like
msstore(Microsoft Store). - Silent install fails: Some installers don't support silent mode. Remove
--silentand let the installer run normally, or check the package's manifest for supported switches. - Winget not recognized: On older Windows versions, you may need to install the App Installer from the Microsoft Store. On current versions, it's preinstalled.
- Script stops on error: By default, a batch script continues even if a command fails. Add
if errorlevel 1 exit /b 1after each command to stop on failure.
WinGet vs. Chocolatey vs. Scoop
WinGet isn't the only package manager for Windows. Two popular alternatives are Chocolatey and Scoop. Here's a quick comparison:
- WinGet: Built-in, no extra installation, backed by Microsoft, uses community repo. Good for general users and basic automation.
- Chocolatey: Older, more mature, has a larger repository, but requires a paid license for commercial use. Excellent for system administrators.
- Scoop: Focuses on developer tools, installs to user directory (no admin needed), and is great for portable apps. Smaller repo but very clean.
For most people, WinGet is the easiest starting point because it's already there. If you need advanced features like package dependencies or custom scripts, Chocolatey or Scoop might be better.
Is WinGet Safe?
WinGet is generally safe because it downloads installers from the official publisher's source, not a third-party mirror. The community repository is moderated, but it's not infallible. A malicious or outdated package could slip through, though it's rare. To minimize risk:
- Always use the
-e(exact) flag with the ID to avoid ambiguity. - Check the package's source URL in the manifest if you're unsure.
- Keep WinGet updated:
winget upgrade --id Microsoft.Winget. - Review the script before running it, especially if you downloaded it from the internet.
WinGet also supports hash verification for some packages, but not all. For high-security environments, you may want to verify checksums manually.
Real-World Automation Scenarios
Here are a few practical ways people use WinGet automation:
- New PC setup: Run a script that installs your browser, office suite, media player, and utilities in one go.
- Dev environment: Install Git, VS Code, Python, Node.js, and Docker with a single command.
- Bulk updates: Use
winget upgrade --allto update every installed package at once. Automate it with a scheduled task. - Reproducible builds: Export your package list to a JSON file, commit it to your repo, and let teammates import it.
For scheduled updates, you can create a Task Scheduler entry that runs winget upgrade --all --silent weekly. This keeps software current without manual effort.
Frequently Asked Questions
Can WinGet install software without admin rights?
Generally no. Most installers require administrator privileges to write to Program Files and the registry. However, some packages (like Scoop-based ones) install to your user folder and don't need admin. WinGet itself can run as a standard user, but the installer it launches may prompt for UAC.
Does WinGet work on Windows 10?
Yes, WinGet is available on Windows 10 version 1809 and later, and on Windows 11. On older builds, you can install the App Installer from the Microsoft Store to get WinGet.
Can I use WinGet to uninstall software?
Yes, use winget uninstall --id Package.ID. It will attempt to run the uninstaller silently if supported. Not all apps support silent uninstall, so you may see a GUI prompt.
What is the difference between winget install and winget upgrade?
install installs a new package, while upgrade updates an already-installed package to a newer version. winget upgrade --all updates everything that has an update available.
How do I see what packages are already installed via WinGet?
Run winget list. It shows all packages that WinGet knows about, including those installed outside WinGet if they have a matching manifest.
Can I create a portable app with WinGet?
WinGet doesn't create portable apps by default; it installs normally. For portable apps, use Scoop, which is designed for that purpose.