my $pid = fork(); if (!$pid) { system($command); } else { sleep $max_time; print "Since $max_time minutes have elapsed, will kill process with PID $$ "; system("TASKKILL /F /T /PID $$"); }