http://qs321.pair.com?node_id=394235


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";