#! perl -slw use strict; print "$0 running as $$"; my( $target ) = map { 1+ index( $_->[0] // '', $0 ) && $_->[1] != $$ ? $_->[1] : () } map[ (split ',', $_ )[1,24] ], `wmic process list full /format:csv`; if( $target ) { print "Found another running as $target; usurping it."; kill 9, $target; } sleep 1e6;