Le mer. 4 mai 2022 à 08:44, Kai Köhne <kai.koe...@qt.io> a écrit :
> They are not _included_ in the MaintenanceTool package. Anyhow, 
> "deferredrenameXXXXXX.vbs”are temporary files the MaintenaceTool.exe writes 
> to schedule an update of itself. That is, because on Windows an executable 
> cannot be replaced when it is running, the MaintenanceTool.exe
>
> Saves the new MaintenanceTool.exe in parallel
> Writes above .vbs file, and starts it
> Stops itself
>
> The .vbs script will then every second try to replace the original .exe file, 
> and – after being successful – restarting the MaintenanceTool.

Hi,

Is there a reason to be using a vbs file ? In windows a running
executable cannot replace itself, but it can rename itself. The way
I've done it in the past is:

* The running executable renames itself.
* It then creates the new executable with the correct name.
* Just before returning from main, it starts the new executable (there
is a short window of time where both the old and new one can be
running, but it doesn't matter if the old one is not using any
resources any more ; if need be, the new one can be given a flag to
wait for the old one to exit).

I find it simpler, and much less likely to trigger an antivirus than a
vbs file :)

-- 
Julien Cugnière
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to