Winget-AutoUpdate
Winget-AutoUpdate copied to clipboard
Winget version with the now stable v1.3.2091
But now when I as a user runs winget --version:
v1.3.2091
When WAU runs in System contrext:
13:22:47 - Winget Version: v1.3.0-preview
So, the Get-WingetCmd.ps1 doesn't detect the latest version:
#Get WinGet Path (if admin context)
$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
if ($ResolveWingetPath) {
#If multiple version, pick last one
$WingetPath = $ResolveWingetPath[-1].Path
}
I have two versions now:
2022-08-13 05:19 <DIR> Microsoft.DesktopAppInstaller_1.18.2091.0_neutral_split.language-sv_8wekyb3d8bbwe
2022-08-13 05:19 <DIR> Microsoft.DesktopAppInstaller_1.18.2091.0_neutral_split.scale-100_8wekyb3d8bbwe
2022-08-13 05:19 <DIR> Microsoft.DesktopAppInstaller_1.18.2091.0_x64__8wekyb3d8bbwe
2022-06-09 20:36 <DIR> Microsoft.DesktopAppInstaller_1.18.431.0_x64__8wekyb3d8bbwe
2022-08-13 05:19 <DIR> Microsoft.DesktopAppInstaller_2022.728.1939.0_neutral_~_8wekyb3d8bbwe
Originally posted by @KnifMelti in https://github.com/Romanitho/Winget-AutoUpdate/discussions/61#discussioncomment-3389270
...and that affects Winget-Install and Winget-Install-GUI too, or...?
...I think this is the solution (?):
$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe" | Sort-Object -Property {$_.Name -as [int]}
not sure to understand -Property {$_.Name -as [int]}
It sorts the array so that the 1.18.2091.0 is the last one, not 1.18.431.0
Try it out...
Edit: changed it to -Property {$_.Path -as [int]}
https://stackoverflow.com/questions/33664892/sort-directory-name-using-powershell#comment55103191_33664892
yes, but in our case, i don't how it can work because the folder names are not "integers"
No, but -as is the keyword, it seems to sort the string and then the numbers in the strin as INT...
This issue is stale because it has been open for 30 days with no activity.