I created an exe
with NSIS
that installs my application, but if the application is already running, it gets updated at startup.
It seems this simplest way to achieve this is by added a registry entry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
My entry looks like this:
Value name: InstallRUS
Value data: cmd /C "C:\Location\of\my\program.exe /S"
This executable simply copies files to a directory and runs a script to register the app as a windows service.
If I restart windows, it runs twice, the first time in silent mode, and the second time it seems to ignore the silent flag.
If I log out and log back in, it's correctly ran once in silent mode.
This leads to the conclusion that the task is ran at windows startup and login, yet the documentation states :
Run and RunOnce registry keys cause programs to run each time that a user logs on...By default, the value of a RunOnce key is deleted before the command line is run.
Does windows starting up counts as "user login"?
Why is the entry not deleted after the first run?
How can I fix this?
Why is windows lying to me?
Note:
- I'm using Windows 7 Professional x32
- Seems to be related to this: Windows Registry RunOnce Loop but I am not writing to the registry