#!/usr/bin/env perl use warnings; use strict; my $pathToMyself = $0; local $, = "\n\t* "; local $\ = $/; print "\t".$^X, $0, @ARGV; restartMe() unless @ARGV; sub restartMe { print "Restarting $pathToMyself...\n"; #exec( $^X, $pathToMyself ) or die "couldn't exec $pathToMyself: $!"; #system(1, $^X, $pathToMyself, "don't Restart", "final" ); exit; #system(1, "cmd.exe", "/c", $^X, $pathToMyself, "final"); exit; exec("cmd.exe", "/c", $^X, $pathToMyself, "final") or die "couldn't exec $pathToMyself: $!"; } #### system(1, $pathToMyself, "don't Restart", "final" ); exit; #exec( $pathToMyself, "final" ) or die "couldn't exec $pathToMyself: $!"; # can't exec ___: Exec format error -- because this runs without the cmd.exe overhead, so it doesn't try the association for .pl file