Skip to content

[FEATURE REQUEST] Custom update scripts #1225

Closed

Description

@Chaython

Please confirm these before moving forward

  • I have searched for my feature proposal and not found a work-in-progress/duplicate/resolved/discarded issue.
  • This proposal is a completely new feature. If you want to suggest an improvement or an enhancement, please use this template

Describe the new feature

Allow users to set a script, to update from, when an update is available.
This would be useful for modified apps like "block the spot" and "better discord".

*User installs app
*User adds custom update variables
*Winget finds update for app "app"
*User checks and selects "update selected packages"
*Custom update script is ran

Describe how this new feature could help users.

It will stop functionality break, and make updating moded apps more convenient.

Activity

  1. added
    new-feature
    on Jul 19, 2023
  2. Chaython commented on Jul 19, 2023

    @Chaython
    Author

    This kind-of already exists via "custom command line argument", but it's not as simple as copy pasting the powershell script from block the spot's readme....

    If there's an easy way to tell it to skip udpating from repo and instead running the script via the existing interface lmk.

    So far it seems more convenient to run the powershell script on start up. Than it is to run it via winget.

    Perhaps this is similar to #1117

    But I really just want to ignore, existing winget etc, and on 'update found' trigger powershell script

  3. marticliment commented on Jul 29, 2023

    @marticliment
    Collaborator

    So, you mean something like custom post-install scripts?

  4. Chaython commented on Jul 31, 2023

    @Chaython
    Author

    Ya, I guess.
    For example block the spot just uses:
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-Expression "& { $(Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/mrpond/BlockTheSpot/master/install.ps1') } -UninstallSpotifyStoreEdition -UpdateSpotify"
    I'd need to run this every time I update spotify. Or download the .dll and drop it in the spotify folder every time there's an update to spotify. Just a minor inconvenience.
    Same with better discord, a discord update often needs a reinstall of better discord.

    Also would be convenient if you could right click apps in the installed list to go to the app folder. I assume the current logging could already see the output folder[s]? It also seems wingetui checks against the registry, which registry has the installed folder.

  5. marticliment commented on Jul 31, 2023

    @marticliment
    Collaborator

    Also would be convenient if you could right click apps in the installed list to go to the app folder. I assume the current logging could already see the output folder[s]? It also seems wingetui checks against the registry, which registry has the installed folder

    This is not true. There is no viable way of getting the install location from WingetUI.

    Regarding the feature, it could be done, i don't see why not

  6. Chaython commented on Jul 31, 2023

    @Chaython
    Author

    This is not true. There is no viable way of getting the install location from WingetUI.

    Well for example the %LocalAppData%\Programs\WingetUI\choco-cli\logs writes SOME install locations "2023-07-29 00:09:27,786 8424 [INFO ] - Software installed to 'C:\Program Files\Proton\VPN'" Also obviously the windows registry has install locations.
    Querying the choco log for software locations and caching the locations would be fairly simple

    `$LogPath = "$env:LocalAppData\Programs\WingetUI\choco-cli\logs\chocolatey.log"
    $SearchString = "Software installed to "
    $OutputFile = "Software install location.log"

    Get-ChildItem $LogPath -Filter .log | ForEach-Object {
    $Content = Get-Content $_.FullName
    $Matches = [regex]::Matches($Content, "$SearchString'([^']
    )'")
    foreach ($Match in $Matches) {
    $InstallLocation = $Match.Groups[1].Value
    Add-Content $OutputFile $InstallLocation
    }
    }
    `

  7. marticliment commented on Aug 1, 2023

    @marticliment
    Collaborator

    This is not true. There is no viable way of getting the install location from WingetUI.

    Well for example the %LocalAppData%\Programs\WingetUI\choco-cli\logs writes SOME install locations "2023-07-29 00:09:27,786 8424 [INFO ] - Software installed to 'C:\Program Files\Proton\VPN'" Also obviously the windows registry has install locations. Querying the choco log for software locations and caching the locations would be fairly simple

    `$LogPath = "$env:LocalAppData\Programs\WingetUI\choco-cli\logs\chocolatey.log" $SearchString = "Software installed to " $OutputFile = "Software install location.log"

    Get-ChildItem $LogPath -Filter .log | ForEach-Object { $Content = Get-Content $.FullName $Matches = [regex]::Matches($Content, "$SearchString'([^']_)'") foreach ($Match in $Matches) { $InstallLocation = $Match.Groups[1].Value Add-Content $OutputFile $InstallLocation } } `

    Ok, let's assume we get the paths of all the chocolatey packages. How do we get the winget ones? and the scoop ones? they don't use logs from where locations can be extracted...

  8. Chaython commented on Aug 1, 2023

    @Chaython
    Author

    Ok, let's assume we get the paths of all the chocolatey packages. How do we get the winget ones? and the scoop ones? they don't use logs from where locations can be extracted...

    Does scoop not put all packages in %userprofile%\scoop\apps ? So just parse the name of the scoop app from that dir?

  9. ppvnf commented on Aug 1, 2023

    @ppvnf
    Contributor

    this seems to be an open issue for Winget tho microsoft/winget-cli#2298

  10. Chaython commented on Aug 1, 2023

    @Chaython
    Author

    this seems to be an open issue for Winget tho microsoft/winget-cli#2298

    Seems relevant but exclusively pertaining to winget

  11. Chaython commented on Aug 1, 2023

    @Chaython
    Author

    Get-WmiObject -Class Win32_Product | Select-Object Name, InstallLocation
    will also display install locations of a few apps

  12. ThioJoe commented on Jun 6, 2024

    @ThioJoe

    Would really like post-install update scripts, or even just the ability to run a specific command after install to be able to call a batch file. For example "Git For Windows" adds a couple of stupid context menu entries on every update, and I have a batch script I have to run that removes the registry entries for it. Would be nice to have this automatic.

    I see in #2160 someone requested the same thing but that was marked as a duplicate but it's really not, it's subtly different from this one which is for entire update scripts. Post-update scripts should be much easier to implement since it's totally separate from the installation process.

  13. soredake commented on Jun 7, 2024

    @soredake

    For example "Git For Windows" adds a couple of stupid context menu entries on every update

    I avoid this context menus by installing git with custom parameters like this winget install --no-upgrade --scope machine -h --accept-package-agreements --accept-source-agreements Git.Git --custom '"/COMPONENTS="icons,assoc,assoc_sh,,,,gitlfs,icons\quicklaunch" /o:SSHOption=ExternalOpenSSH"

  14. marticliment commented on Jun 20, 2025

    @marticliment
    Collaborator

    Hello,

    I have published a PreRelease version of UniGetUI that allows to specify pre/post install/update/uninstall commands/scripts. I'd appreciate if you could test it and provide some feedback.

    Thanks!
    Download link: https://github.com/marticliment/UniGetUI/releases/tag/3.2.1-beta1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

new-featureready-to-go

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions