Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: Windows - have program replace itself

by sgifford (Prior)
on Sep 27, 2004 at 16:31 UTC ( #394235=note: print w/replies, xml ) Need Help??

in reply to Re: Windows - have program replace itself
in thread Windows - have program replace itself

IIRC, the problem is that Windows won't let you overwrite or delete a running program; that's why upgrades of running programs often require a reboot.

Assuming exec works properly on Windows, one possible workaround would be to launch a second script which would download the first script, then re-execute it:

# script 1 sub upgrade { exec('upgrade',$0,@ARGV) or die "exec failed! $!\n"; } # upgrade script download_new_version($ARGV[0]); exec(@ARGV) or die "exec failed! $!\n";

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://394235]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2023-02-05 14:34 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (31 votes). Check out past polls.