How to create an exe that deletes the dir it is in (including itself)

Viewed 95

I am a python developer and I made a program and packed it with inno setup. inno setup automatically creates 2 files one of them a unins000.dat file and a unins000.exe file when starting the .exe it will fully uninstall everything that you installed including the exe itself

now the 2 problems I have with this is:

  1. it also creates a .dat file and I just want 1 exe to uninstall the entire program
  2. the exe and dat files are both called unins000 and not just uninstall

(I have already tried renaming them but then the exe just doesn't work anymore)

so I found a way to disable the creation of these files

so now I am trying to create a .exe file that can delete the entire directory it is in including itself I have started using python so I coded a script which deletes the entire dir the python script is in but when I package it into an exe using pyinstaller it doesn't work anymore

How can I make an executable that when run deletes the directory where it is in including itself?

1 Answers

You can create exe that after start makes copy of itself into temp folder, then starts this copy and stops original process. Then the second process can delete whole folder. Then after some time OS should delete file left in temp folder on it's own.

Related