Fixed multiple Winget installed versions

pull/40/head
Romain 2022-04-07 12:40:10 +02:00
parent 41b61bd4d4
commit cefdac2daa
2 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<app> <app>
<name>Winget-AutoUpdate (WAU)</name> <name>Winget-AutoUpdate (WAU)</name>
<version>1.7.0</version> <version>1.7.1</version>
<author>Romanitho</author> <author>Romanitho</author>
<info>https://github.com/Romanitho/Winget-AutoUpdate</info> <info>https://github.com/Romanitho/Winget-AutoUpdate</info>
</app> </app>

View File

@ -6,8 +6,13 @@ function Get-WingetOutdatedApps {
[string]$AvailableVersion [string]$AvailableVersion
} }
#Get WinGet Path #Get WinGet Path (if admin context)
$WingetPath = (Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe").Path $ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
if ($ResolveWingetPath){
#If multiple version, pick last one
$WingetPath = $ResolveWingetPath[-1].Path
}
#Get Winget Location in User context #Get Winget Location in User context
if ($WingetCmd){ if ($WingetCmd){
$Script:Winget = (Get-Command winget.exe -ErrorAction SilentlyContinue).Source $Script:Winget = (Get-Command winget.exe -ErrorAction SilentlyContinue).Source