in reply to caller of perl script
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Win32::Process::Info; my $pi = new Win32::Process::Info;; my @info = $pi->GetProcInfo( $$ ); my $ppid = $info[0]{ ParentProcessId }; # cdarke's addition from here # tasklist outputs a couple of lines of title junk first my ($tl_out) = (qx(tasklist /v /fi "PID eq $ppid"))[-1]; # The bat file name is the last "column" my $parent = (split /\s+/,$tl_out)[-1]; # $parent should now give the bat file name print "$parent\n";
|
|---|