[Tutor] Self-Deleting

Alan Gauld alan.gauld at blueyonder.co.uk
Thu Aug 12 22:43:32 CEST 2004

> Can a programme delete itself?

Yes but how best to do it depends on the OS.

If its Windoze then writing an entry to the RunOnce registry 
entry is usually the best way to do it. Next time the user 
restarts the file gets deleted. (And on Windows that will 
probably be within a day or so! :-) You can also force a 
restart but thats a tad unfriendly. You could also set a 
key that prevents use until the deletion takes place.

The RunOnce program should not only delete the file but 
also clean up the registry etc too of course... Unless you 
want to make sure that they never reinstall for another free 
trial, in which case leave one key live...

Lots of options.

In Unix the options are many and varied including just 
deleting the file directly, setting cron jobs, etc etc...

Alan G.

More information about the Tutor mailing list