谢谢,求一个per写的关闭windows上软件进程的脚本

谢谢,求一个per写的关闭windows上软件进程的脚本

求一个per写的关闭windows上软件进程的脚本,谢谢大大们了!
my $comm = "ntsd -c q -p PID";

system( $comm );
use Win32::API;
use Win32::Process::List;

sub KillProcess {
    $pid = shift;
    $OpenProcess = new Win32::API("kernel32.dll","OpenProcess",[I,I,N],N);
    $PROCESS_ALL_ACCESS = 0x0001;
    $hProcess = $OpenProcess->Call($PROCESS_ALL_ACCESS,0,$pid);
    
    $TerminateProcess = new Win32::API( 'Kernel32.dll', 'TerminateProcess', [N,I], I );
    $kill = $TerminateProcess->Call($hProcess,1);
}

$P = Win32::Process::List->new();
%list = $P->GetProcesses();
foreach (keys %list){
    if($list{$_} ~~ "進程名"){
        KillProcess($_);
    }
}




QUOTE:
原帖由 lokchungk 于 2008-12-17 16:11 发表
12333333333

有時後需要用AdjustTokenPrivileges這個API函數來提升權限
遲些有空寫一個給您
對不起
由於在我點選"回复"時,
只能在"快速回复主题"編輯帖子,
不能插入代碼,
所以就用"12333333333 "代替,
然後再用"编辑"更改內容.
但那時連線速度慢,
所以還未改好就被閣下發現了.

對閣下造成的不便,
我僅此致歉
好帖收藏
perldoc -f kill

Perl5100delta
====================================================================================
kill() on Windows
On Windows platforms, kill(-9, $pid) now kills a process tree. (On UNIX, this delivers the signal to all processes in the same process group.)
====================================================================================
but it always not work due to the privicy

Win32::Process::KillProcess($you_pid,0);