Search code examples
windowselectronnw.js

Cannot delete EXE after stopping the application


It looks like some executables do not shut down correctly on Windows. After stopping the application, and deleting the corresponding exe file, it immediately pops up again in the folder. I have to wait for some time (sometimes even minutes) until I can really remove it. Is there any reason/solution for this strange behavior?

This is very annoying, because I'm creating a release directory with a batch script, which previously removes the release directory in case it already exists.


Solution

  • I finally found the reason, thanks to this post:

    https://superuser.com/questions/338567/why-cant-i-delete-some-exe-files/521349#521349

    For some really really crazy (Microsoft internal) reasons you must have the "Application Experience service" enabled!!! God knows why! On German installations the service is called "Anwendungserfahrung". On my machine it was disabled. As soon as I enabled it, I was able to delete executable files immediately after terminating the EXE/programm!

    I hope this post prevents others from going crazy like I did! ;-)