Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if Package installed #291

Closed
ghost1372 opened this issue May 22, 2020 · 14 comments
Closed

Check if Package installed #291

ghost1372 opened this issue May 22, 2020 · 14 comments
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.
Milestone

Comments

@ghost1372
Copy link

hi is there any command to check if package installed?

@ghost ghost added the Needs-Triage Issue need to be triaged label May 22, 2020
@KevinLaMS
Copy link
Contributor

Is this with respect to dependencies? Like frameworks or runtimes you may depend on? Or other packages?

@ghost1372
Copy link
Author

@KevinLaMS Just as we can easily install packages (winget install id), a simple command (winget exist id) can check the user's system for the installation of that package and return true or false

@megamorf
Copy link

No, there's no implementation for that yet. Subscribe to #153

@KevinMarquette
Copy link

It would be even more helpful if we could also specify a PowerShell ExistsScript script in the manifest to check if the package needs to be installed to support the exist option. The winget exist sysinternals would use that script to return true or false. If provided, it could also run before the install to see if it even needs to install anything and it could run after the install to verify it was installed. This is a pattern used by DSC so its something the PowerShell community is aware of.

@ashpatil-msft ashpatil-msft added Issue-Feature This is a feature request for the Windows Package Manager client. and removed Needs-Triage Issue need to be triaged labels May 28, 2020
@ashpatil-msft ashpatil-msft added this to the Package Manager Backlog milestone May 28, 2020
@andypiper
Copy link

I'd like the ability to know which packages are installed / have been installed via winget; and to ideally export to a file for future setups. My use case is a brand new Surface Laptop 3, migrating from an HP, would be great to know what I just winget-installed, and to export to a file for a future new setup, similar to a Brewfile. I understand that winget is not homebrew, but this would be very useful.

@denelon
Copy link
Contributor

denelon commented Dec 4, 2020

@andypiper the experimental "list" command will tell you everything that is installed on the system. We have #220 export/import on the backlog to do what you're talking about.

@iDolmatov
Copy link

Also available for one application.

Windows Package Manager v1.0.11451
Windows: Windows.Desktop v10.0.19043.1023
Microsoft.DesktopAppInstaller v1.11.11451.0

image

@Croydon
Copy link

Croydon commented Jul 4, 2021

I have a script that installs and updates certain software. It does not currently use winget, because of the lack of an easy way to check first if a package is already installed.

Basically, do a winget install if package X in version Y is not yet installed, if it is already installed, return true and do nothing.

@sanamhub
Copy link

sanamhub commented Oct 6, 2021

This behavior is different as per the apps:

Note: Below packages are already installed!

When AnyDesk is already installed:
Input: winget install AnyDeskSoftwareGmbH.AnyDesk
Output: Installer failed with exit code: 11341828

When Notepad++ is already installed:
Input: winget install Notepad++.Notepad++
Output: Multiple packages found matching input criteria. Please refine the input.

Where, Some other packages get insalled again.. 😞
Really need a solution for this.. Like check if already installed and skip install or check if exists..

Btw, winget downloads the package at first and proceeds next (error/install/shows already exists)

@sanamhub
Copy link

sanamhub commented Oct 6, 2021

@KevinLaMS Just as we can easily install packages (winget install id), a simple command (winget exist id) can check the user's system for the installation of that package and return true or false

winget exist id didn't work!

@denelon
Copy link
Contributor

denelon commented Oct 6, 2021

@sanamhub you can use winget list <package> to see if a package is installed. If you're comparing against the "winget" source the command supports comparing against name, id, and moniker. The "msstore" source doesn't support these fields yet, we're still working on it.

PS C:\Users\denelon> winget list vscode
Name                         Id                         Version Source
-----------------------------------------------------------------------
Microsoft Visual Studio Code Microsoft.VisualStudioCode 1.60.2  winget

@denelon denelon modified the milestones: v.Next-Client, v1.2-Client Oct 6, 2021
@denelon
Copy link
Contributor

denelon commented Oct 6, 2021

I've looked at all of the other comments on this issue. I believe they are either implemented or already on the backlog as another issue. I'm going to go ahead and close this one.

@alanlivio
Copy link

alanlivio commented Mar 20, 2024

To the ones still looking for an answer, this works for me:

winget list -q $id | Out-Null
if ($?) {  echo "$id installed" }

@rdev32
Copy link

rdev32 commented Sep 15, 2024

alanlivio

thank you brother! you saved me another week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
Development

No branches or pull requests