goibhniu-
I wrestled with wmic a while back and came up with a very perl-friendly way to access the data.
The key is using list /format:value on the command line.
-Craig
use strict;
use Tk;
use Data::Dumper;
my %DATA;
# Get info via wmic (not available on all versions of windows)...
my @data = split(/^\s*\cM\n/m, `wmic process list /format:value`);
shift(@data); pop(@data); # Remove first/last blank lines
my %procs;
# Iterate through each element...
foreach my $p (@data) {
$p =~ s/\cM//g; # Grrrr, rotten windows
my %child = split(/[=\n]/, $p); # Hashify information
$procs{$child{ProcessId}} = \%child;
}
print Dumper(\%procs), "\n";