#! /usr/bin/perl use strict; use warnings; use Win32::Process; ######################################################################################## #MiscVariables my ($VERSION, $ProcessObj); ######################################################################################## $VERSION = "1.0.0"; Win32::Process::Create($ProcessObj, "$ENV{'SystemRoot'}/notepad.exe", "notepad test.txt", 0, # Don't inherit. NORMAL_PRIORITY_CLASS, ".") or die "Cannot Launch Anything\n"; if ($ProcessObj->Wait (10*1000)){ # execution of the process is successfully. $ProcessObj->Kill(0); print "Successful\n"; } else { # process has hung up for some reason print "The Process Hung - Killing it\n"; $ProcessObj->Kill(255); }