Search notes:

Script: kill-procs.pl

use warnings;
use strict;
use Win32::Process;
use Win32::Process::List;

my $which = shift; # 'open-office';

unless ($which) {
  usage();
  exit -1;
}
my $reg_ex;
if ($which eq 'open-office') {
  $reg_ex = 'soffice.exe|soffice.bin|swriter.exe';
}
elsif ($which eq 'ID') { # Input Director
  $reg_ex = 'InputDirectorSessionHelper.exe';
}
elsif ($which eq 'show') {
}
else {
  usage();
  exit -1;
}


my $procs = new Win32::Process::List;
my %proc_list = $procs->GetProcesses();
foreach my $pid ( keys %proc_list ) {
  if ($which eq 'show') { 
    printf "%4d %s\n", $pid, $proc_list{$pid};      
    next;
  }
  if ($proc_list{$pid} =~ /$reg_ex/) {
     print "$proc_list{$pid} $pid\n";      
     if (Win32::Process::KillProcess($pid, 0)) {
       print "Killed $proc_list{$pid} ($pid)\n";   
     } else {
       print "For a reason $proc_list{$pid} ($pid) was not killed\n";   
     }
  }
}

sub usage {
  print "
    kill-procs.pl open-office
    kill-procs.pl InputDirectorSessionHelper
";

}
Github repository scripts-and-utilities, path: /kill-procs.pl

See also

kil.ps is a PowerShell script to kill processes by their name.
Scripts
Perl modules Win32::Process and Win32::Process::List

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759383360, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/tools/scripts/personal/kill-procs_pl(93): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78