perl获取windows进程列表use Win32::Process::List? my $P Win32::Process::List-new() # constructo
perl获取windows进程列表
use Win32::Process::List;
? my $P = Win32::Process::List->new(); # constructor
? my %list = $P->GetProcesses(); ? ? ? # returns the hashes with PID and process name
? foreach my $key ( keys %list ) {
? ? ? ? # $list{$key} is now the process name and $key is the PID
? ? ? ? print sprintf("%30s has PID %15s", $list{$key}, $key) . "\n";
? }
? my $PID = $P->GetProcessPid("explorer");# get the PID of process explorer.exe
? my $np = $P->GetNProcesses(); # returns the number of processes
