winget-silent-install
Non-interactive winget installation pattern.
Pattern
powershell
winget.exe install --id "{PACKAGE_ID}" --exact --source {SOURCE} --accept-source-agreements --disable-interactivity --silent --accept-package-agreements --force
Exact Matching
The --exact flag ensures only exact package ID matches are considered.
Prevents ambiguous matches when package ID is substring of other packages.
Sources
Two primary sources:
- •winget — Default winget community repository
- •msstore — Microsoft Store packages
Specify with --source flag: --source winget or --source msstore
Flags
| Flag | Purpose |
|---|---|
--id | Package identifier to install |
--exact | Match package ID exactly (no partial matches) |
--source | Specify package source (winget or msstore) |
--accept-source-agreements | Auto-accept source license agreements |
--disable-interactivity | Disable all interactive prompts |
--silent | Minimal console output |
--accept-package-agreements | Auto-accept package license agreements |
--force | Reinstall if already installed |
Force Flag
Using --force ensures consistent state by reinstalling even if package exists.
Useful for automation scripts where you want guaranteed fresh installation.
Examples
powershell
# From winget (default source) winget.exe install --id "Microsoft.PowerShell" --exact --source winget --accept-source-agreements --disable-interactivity --silent --accept-package-agreements --force # From Microsoft Store winget.exe install --id "XPFFTQ032PTPHF" --exact --source msstore --accept-source-agreements --disable-interactivity --silent --accept-package-agreements --force
Usage in Scripts
This pattern is used throughout the winsetup-skills repository for consistent, reliable package installations without user intervention.