# 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 :-)# author: think.hy@gmail.com# date: 5/3/2013#! perluse warnings ;use strict ;use Win32:: OLE qw(in) ;use Win32:: Process ;sub matching_processes {my ( $pattern ) = @_ ;my $objWMI = Win32:: 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: $name\tPID: $pid \n" ;#Win32::Process::KillProcess($pid, 0);system ( "TASKKILL /F /T /PID $pid" );}
Use Perl to Kill Lotus Notes Processes on Windows
最新推荐文章于 2024-03-15 18:41:19 发布
作者因频繁遭遇Notes程序崩溃而浪费大量时间重启程序,为此编写了一个Perl脚本自动终止并重启Notes进程。该脚本通过匹配Notes相关进程名称来定位并结束这些进程。


3185

被折叠的 条评论
为什么被折叠?



