0

I'm learning about the powershell use. I really like the winget list command and how easy winget is to uninstall thing from my computer! But I really can't find in the documentation a way to uninstall multiple packages at the same time!

My solution was repeat the command, like this:

winget uninstall --id "Microsoft.ZuneVideo_8wekyb3d8bbwe" && winget uninstall --id "Microsoft.YourPhone_8wekyb3d8bbwe"

works, but I want a shorter solution!!

thanks!!

(:

mklement0
  • 382,024
  • 64
  • 607
  • 775

1 Answers1

2

winget uninstall only supports uninstalling one package at a time, so you'll have to make a call for each of the multiple packages you want to uninstall, which you can easily do with ForEach-Object (whose built-in alias is %, if you're looking for a shorter solution for interactive use):

'Microsoft.ZuneVideo_8wekyb3d8bbwe', 'Microsoft.YourPhone_8wekyb3d8bbwe' |
  ForEach-Object { winget uninstall --id $_ }

This will uninstall the specified packages sequentially.

While there are ways to run the uninstallation commands in parallel, notably with ForEach-Object -Parallel in PowerShell (Core) 7+, doing so may cause interference between the uninstallation operations.

mklement0
  • 382,024
  • 64
  • 607
  • 775