加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Use Perl to Kill Lotus Notes Processes on Windows

发布时间:2020-12-16 00:13:24 所属栏目:大数据 来源:网络整理
导读:# Recently,I experienced Notes crash problems several times.? # It wasted me a lot of time to terminate Notes completely and then restart it, # so I wrote this Perl script to save myself. Also hope it's helpful to you when you read these c
 
 
 
 
# Recently,I experienced Notes crash problems several times.?
# It wasted me a lot of time to terminate Notes completely and then restart it,
# so I wrote this Perl script to save myself. Also hope it's helpful to you when you read these comments :-)
# https://gist.github.com/di3du/5508299
# author: think.hy@gmail.com
# date: 5/3/2013
#! perl
?
use warnings ;
use strict ;
?
use Win32:: OLE qw(in) ;
use Process ;
?
sub matching_processes {
my ( $pattern ) = @_ ;
?
my $objWMI = OLE -> GetObject ( 'winmgmts://./root/cimv2' );
my $procs = $objWMI -> InstancesOf ( 'Win32_Process' );
?
my @hits ;
foreach my $p ( in $procs ) {
push @hits => [ $p -> Name , $p -> ProcessID ]
if $p -> Name =~ /$pattern/ ;
}
?
wantarray ? @hits : @hits ;
}
?
my $notesStyle = qr/(notes.exe)|(nlnotes.exe)|(ntaskldr.exe)|(nminder.exe)|(nsd.exe)/ i ;
?
foreach ( matching_processes $notesStyle )
{
my $name = $_ -> [ 0 ];
my $pid = $_ -> [ 1 ];
?
print "Name: $nametPID: $pid n" ;
#Win32::Process::KillProcess($pid,0);
system ( "TASKKILL /F /T /PID $pid" );
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读