Can Winget uninstall multiple packages?

1.7k Views Asked by At

How can one use winget 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"

But is there a better way?

1

There are 1 best solutions below

0
mklement0 On

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.