Community
    • Login

    Update CLI command

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 4 Posters 5.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Michal ŠunkaM
      Michal Šunka
      last edited by Michal Šunka

      Hello,

      I might have a rather specific question - is there any possibility to launch Notepad++'s auto-updater from Windows commandline (powershell/cmd)?

      Use case is that I am working in corporate enviroment and I am requested to keep my tools updated (Notepad++ included).

      Since I have under my supervision something like 10 instalations at different servers, I would like to make a centralised (Ansible perheaps?) script which will connect to each server, and run some command to launch auto-update.

      I am avare that re-installing with Notepad++ binary downloaded at a side might do the trick, but I am curious anyway about the command :-)

      Thank you,
      Michal

      PeterJonesP mkupperM 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Michal Šunka
        last edited by

        @Michal-Šunka ,

        I’ve never done it, but from this piece of source code, I believe that when Notepad++ runs the updater, it is essentially running the bundled gup.exe, possibly with some command-line parameters

        When I did the search through the code on the getWingupCommands and things that influence it, I could only find the Plugins Admin using the command-line options. Oh, no, some more searching finds that when you run it through the ? > Update Notepad++ entry, it ends up running this section of code which didn’t use the getWingupCommands() call, but still adds command-line arguments.: you can dig into that section of code to see what command-line arguments it runs.

        1 Reply Last reply Reply Quote 1
        • mkupperM
          mkupper @Michal Šunka
          last edited by

          @Michal-Šunka To add to what @PeterJones posted, you can run gup.exe --help (with two leading – dashes) and it’ll show you the command line options.

          Typically, when someone selects the ? / Update Notepad++ menu option it runs
          "C:\Program Files (x86)\Notepad++\updater\gup.exe" -verbose -v8.55 where the -v8.55 is the current version of Notepad++.

          gup.exe has a web site, https://wingup.org/, but the details of the command line options don’t seem to be explained so you can figure out what works best for your setup.

          1 Reply Last reply Reply Quote 1
          • D
            davidtrevor23
            last edited by

            All the gup.exe does is to check if there is a newer version than specified by the string input parameter is available. It does not handle the update itself. You would have to code it for yourself.

            For example like this in Powershell 5.1 for the 64bit version of Notepad++.

            [string]$ScriptFolder = $PSCommandPath | Split-Path -Parent
            
            $Notepad = Get-ItemProperty -LiteralPath 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\Notepad++'
            $InstalledVersion = $Notepad.DisplayVersion
            
            $UpdateCheck = Invoke-WebRequest -Uri "https://notepad-plus-plus.org/update/getDownloadUrl.php?version=$InstalledVersion"
            $UpdateCheckAnswer = ([xml]$UpdateCheck.Content).GUP
            
            if ($UpdateCheckAnswer.NeedToBeUpdated -eq 'yes') {
                $Filename = $UpdateCheckAnswer.Location.Split('/')[-1]
                Invoke-WebRequest -Uri $UpdateCheckAnswer.Location -OutFile "$ScriptFolder\$Filename"
                & "$ScriptFolder\$Filename" '/S /closeRunningNpp'
            }
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors