in reply to Deleting the Currently Running Script in Win XP
Rather simpler would be to run an asynchronous perl one-liner at the end of the script that waits a couple of seconds for the script to terminate and then deletes it like this:
P:\test>type junk.pl #! perl -slw use strict; sleep 10; ## Simulate doing stuff ## Start an asynchronous perl one-liner ## sleep a couple of seconds and the delete the script ($0) system 1, qq[ perl -e"sleep 2; unlink'$0'" ]; P:\test>junk P:\test>dir junk.pl Volume in drive P has no label. Volume Serial Number is BCCA-B4CC Directory of P:\test File Not Found
|
|---|