would be really cool way to play around.
Just like in the Hollywood movies you can have your own Self Destruction program in no time.
I hope you have basic C/C++ programming knowledge and have a windows based IDE like Dev C++ or
Code:Blocks using which we are going to compile our program.
Here is the self destruction program in c language.
It’s just a basic version. Just change the code according to your needs 🙂
Windows OS does not allow us to EASILY delete the file which is currently loaded in memory(application is running).
That’s why we are going to create a bat file in temporary directory and use it do delete our application.
I think it’s the easiest way.
Do you know any other way… ?
Share it with us in comment below 🙂
#define MAX _MAX_PATH
int main(int argc, char *argv)
void SelfDestruct(char *exepath)
char batcmd[MAX] =":Repeat\ndel \"%s\"\nif exist \"%s\" goto Repeat\ndel \"%s\"" ;
Here’s the code for Linux-style OS. I referred it from StackOverFlow
int main(int argc, char* argv)
Let me know your thoughts in comment below.