@@ -13,6 +13,9 @@ Forward Winget App ID to install. For multiple apps, separate with ",". Case sen
1313. PARAMETER Uninstall
1414To uninstall app. Works with AppIDs
1515
16+ . PARAMETER AllowUpgrade
17+ To allow upgrade app if present. Works with AppIDs
18+
1619. PARAMETER LogPath
1720Used to specify logpath. Default is same folder as Winget-Autoupdate project
1821
@@ -34,14 +37,18 @@ If '-Uninstall' is used, it removes the app from WAU White List.
3437
3538. EXAMPLE
3639.\winget-install.ps1 -AppIDs "7zip.7zip -v 22.00", "Notepad++.Notepad++"
40+
41+ . EXAMPLE
42+ .\winget-install.ps1 -AppIDs "Notepad++.Notepad++" -AllowUpgrade
3743#>
3844
3945[CmdletBinding ()]
4046param (
4147 [Parameter (Mandatory = $True , ParameterSetName = " AppIDs" )] [String []] $AppIDs ,
4248 [Parameter (Mandatory = $False )] [Switch ] $Uninstall ,
4349 [Parameter (Mandatory = $False )] [String ] $LogPath ,
44- [Parameter (Mandatory = $False )] [Switch ] $WAUWhiteList
50+ [Parameter (Mandatory = $False )] [Switch ] $WAUWhiteList ,
51+ [Parameter (Mandatory = $False )] [Switch ] $AllowUpgrade
4552)
4653
4754
@@ -302,7 +309,7 @@ function Test-ModsUninstall ($AppID) {
302309# Install function
303310function Install-App ($AppID , $AppArgs ) {
304311 $IsInstalled = Confirm-Install $AppID
305- if (! ($IsInstalled )) {
312+ if (! ($IsInstalled ) -or $AllowUpgrade ) {
306313 # Check if mods exist (or already exist) for preinstall/install/installedonce/installed
307314 $ModsPreInstall , $ModsInstall , $ModsInstalledOnce , $ModsInstalled = Test-ModsInstall $ ($AppID )
308315
0 commit comments