I have a small application which will run only once on a computer. I would like it to delete itself after it has completed its work. Since it will be running, windows will not allow it to be deleted. One way that I know is to use RunOnce key in the registry. But what command should I enter in the key. Also, is there any other way to self-destruct a file.
Your choice is to is to shell out (to a .BAT file that deletes the .exe)
and then immediately exit the current image file.
I use a PowerBasic DOS routine that waits 2 seconds, then deletes the file. The .BAT is left behind as is the very small PB .exe
Usage:
In a .BAT file
Code:
echo off
cd \where\mydir
REM delfile waits two seonds, so use it only as the first delete call.
c:\LocationOfDelfile\delfile c:\mydir\myfile.exe
del c:\mydir\anotherfile.dat
exit
there is a file in the windows directory you can place a path in, when the system reboots the file at that path is deleted, i am not sure what the file is called sorry
This is what I am looking for. As far as I remember, the entry has to be in Win.ini file, but I don't remember exactly.