'Delete the installer after installation

I'm trying to have the installer [NSIS] deleted after my electron app is installed on a device, so that the user needn't do so

Is there a possible way to achieve this



Solution 1:[1]

So I would not really recommend it but you could try to use the Delete function, specify your installer-file and set the /REBOOTOK Flag.

The code would look something like this:

Delete path\myInstaller.exe /REBOOTOK

This Flag tries to Delete the File right away and if it fails, wich it will since the installer is running, it will delete it after a reboot.

Just keep in mind that you would have to reboot your computer after the installation or the file will not be deleted.

Let me know if this solved your problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SnarkDev