in reply to Windows + Win32::OLE + fork = Hell

I'm just learning about the wonders of the wmic command on windows xp machines.

You can get process information for all processes currently running on your xp box by running the command:

wmic process list /format:value
A quick perl script to play with this might look like:
use Data::Dumper; # Get proc info via wmic (not available on all versions of windows)... my @procs = split(/^\s*\cM\n/m, `wmic process list /format:value`); shift(@procs); # Remove initial blank line # Iterate through each process... foreach my $p (@procs) { $p =~ s/\cM//g; # Grrrr, rotten windows my %node = split(/[=\n]/, $p); # Hashify information print Dumper(\%node); }

Replies are listed 'Best First'.
Re^2: Windows + Win32::OLE + fork = Hell
by cmv (Chaplain) on Oct 04, 2007 at 20:38 UTC
    I've just discovered that killing all running windows process(es) for a particular executable is very easy with wmic:
    WMIC PROCESS where name='evil.exe' delete
    Handy little tool -- too bad it isn't written in perl...