Here is another example by searching for the actual program-name in the process-list:
use Win32::OLE qw(in); use Win32::OLE::Variant; # Find all PIDs, program-names, and executable paths for all running processes. for my $Process (sort{lc($a->{Name}) cmp lc($b->{Name})} in ($WMI->InstancesOf("Win32_Process"))) { $Name = $Process->{Name}; # Process program-name. $Path = $Process->{ExecutablePath}; # Process executable path. $PID = $Process->{ProcessID}; # PID. $Path = '' unless (defined($Path)); # Search for the PIDs for specific program-names. if ($Name =~ /acrobat\.exe/i) {$Acrobat = $PID} if ($Name =~ /acrotray/i) {$Tray = $PID} if ($Name =~ /monitor\.exe/i) {$Monitor = $PID} } # Kill Acrobat if it is running. if ($Acrobat) {kill('STOP',$Acrobat)} # Kill Acrotray if it is running. if ($Tray) {kill('STOP',$Tray)} Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO - USA Central Time Zone 636-755-2652 fax 636-755-2503 [EMAIL PROTECTED] www.nisc.coop ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Darrell Snedecor Sent: Tuesday, September 20, 2005 08:47 To: perl-win32-users@listserv.ActiveState.com Subject: Check for running process How do I use Perl to check for the existence of a running program in Windows? Best Regards Darrell Snedecor Director Harrisburg Project 800-635-5274 618-253-8504 _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs