Skip to content

Comment on Code that will only execute once

Comments

On POSIX systems, this challenge is trivial because you can unlink ("delete") an executable while it's running. The file is then actually deleted once the program exits.

On Window, you can muck around with child processes that delete their parent. Perhaps more interestingly, you could try to abuse Software Restriction Policies [1]. In theory, you should be able to blacklist your own executable (by hash), so that it can't run ever again. This would also block any copy of the file that you might have kept.

[1] http://technet.microsoft.com/en-us/library/bb457006.aspx

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.