unless( @ARGV ){ # open new shell and restart program my $cmd = join ' ', q(cmd.exe /c start ), $^X,__FILE__, '1forargv';; system $cmd; exit; } ... $term->run();