Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit c9119c2

Browse files
authored
Merge pull request #113 from tomamplius/allowupdate
Allow upgrade app
2 parents 64e1f11 + a0d7ef6 commit c9119c2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

winget-install.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Forward Winget App ID to install. For multiple apps, separate with ",". Case sen
1313
.PARAMETER Uninstall
1414
To uninstall app. Works with AppIDs
1515
16+
.PARAMETER AllowUpgrade
17+
To allow upgrade app if present. Works with AppIDs
18+
1619
.PARAMETER LogPath
1720
Used 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()]
4046
param(
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
303310
function 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

Comments
 (0)