winget | real autoupdater finally
I use Notepadd++ for a very long time - since when there was no updater thing at all.
Then the so called autoupdater came, that does anything but auto updating Notepad++
It breaks the workflow, as it pops up in that moment, when you try to do something with Notepad++. I have the choice to manually update Notepad++ or not to do what i really wanted to do. When I decide to update Notepad++, I have to go through the complete setup process - not a single automatismn, nothing.
But a few days ago I found “winget” a paketmanager for windows - what a great invention. And one of the first things that came to my mind, was that it could do for Notepad++ that was missing all the time - autoupdating.
And after some pitfalls it does what an autoupdater is intended to do - it updates Notepad++ automatically, without any userinteraction.
Notepad++ didn’t make it easy, as the installer that winget uses, has an error. It will report the update as successful, even so it didn’t install the update properly. That happens, when Notepad++ is running while winget is trying to update Notepad++. After this failue the update to this version is impossible, as winget, according to the installers information, thinks it is already installed an doesn’t offer the update again. So it is vital to make sure, that notepad++ is not running while updating.
Not a great thing, if you know it, but it took me much more time to find out, than it takes you to read all this text ;o)
So now the updater - it’s just a really simple batch script that I start using task sheduler.
@echo off :check-running tasklist /fi "ImageName eq notepad++.exe" /fo csv 2>NUL | find /I "notepad++.exe">NUL if "%ERRORLEVEL%"=="0" ( timeout /t 300 /nobreak > NUL goto check-running ) else ( winget upgrade --id Notepad++.Notepad++ )
It checks if notepad++ is running and if so, it waits 5 Minutes an checks again. If notepad++ is not running, it starts the update process.
I start the script everytime i start my PC with a 15 minute delay and I really hope that I will never ever have to hear of any Notepad++ updates again.
Maybe it’ll helpful for you, too
It will report the update as successful, even so it didn’t install the update properly. That happens, when Notepad++ is running while winget is trying to update Notepad++.
I will see what I can do about it, I am adding a fix of the silent installer mode (/S), when the Notepad++ is already running, to my TODO-list.