use strict; use warnings; use Data::Dumper; use Win32::Process::Info; my $wpi = Win32::Process::Info->new; my @info = $wpi->GetProcInfo; my @list = grep{ $_->{Name} =~ /cmd\.exe$/ }@info; print $_->{ProcessId}, "\n" for @list; kill $_->{ProcessId} for @list;