Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: How can I build a self-destructing Win32 PERL script?

by RhetTbull (Curate)
on Oct 20, 2001 at 22:24 UTC ( #120297=note: print w/replies, xml ) Need Help??

in reply to How can I build a self-destructing Win32 PERL script?

This is untested on the actual perl directory tree since I don't want to trash my own perl distro but it does work on other directories. I suspect it may work fine on the perl since perl is really no longer running after the exec (you can check this in the task manager) but Win32 may keep the DLLs loaded after an exec -- I'm not sure.
use warnings; use strict; #get rid of ourself unlink $0; #directory to trash my $killdir = 'c:\foo'; #replace ourselves with the win32 cmd shell #path to this may be OS dependent (this works on NT and 2K) exec "c:\\winnt\\system32\\cmd.exe /c RMDIR /S /Q $killdir";


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://120297]
[1nickt]: The Romans were everywhere!
[erix]: everywhere? Not quite. The Limes runs through the Netherlands
[Discipulus]: marto lives above Vallo Adriano, i think
[Discipulus]: Anyway many years passed, we had Perl 3 iirc.. ;=)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2017-11-21 12:11 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (299 votes). Check out past polls.