How much easier do you want it :)
#! perl -slw use strict; use Win32::Process::Info; print "My pid: $$"; my $pi = Win32::Process::Info->new; my @info = $pi->GetProcInfo(); my @procsOfInterest = grep{ $_->{Name} eq $ARGV[ 0 ] } @info; if( @procsOfInterest ) { print "A process with the name $ARGV[ 0 ] was found with pid:", $_->{ProcessId} for @procsOfInterest; } else { print "No process with the name $ARGV[ 0 ] was found"; } __END__ P:\test>381203 perl.exe My pid: 1184 A process with the name perl.exe was found with pid:1184 P:\test>start /b perl -le"sleep 60; print 'Bye'" P:\test>381203 perl.exe My pid: 340 A process with the name perl.exe was found with pid:1600 A process with the name perl.exe was found with pid:340
In reply to Re: find PID for a process/executable running on Win32
by BrowserUk
in thread find PID for a process/executable running on Win32
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |