找回密码
 加入
搜索
查看: 4181|回复: 5

[系统综合] [已解决]排除系统进程将其关闭

[复制链接]
发表于 2013-7-18 14:43:26 | 显示全部楼层 |阅读模式
本帖最后由 qq1244521 于 2013-7-24 20:33 编辑
Dim $Process=0
Local $list = ProcessList() 

For $i = 1 To $list[0][0]
        
                If $list[$i][0] =  "[System Process]"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                If $list[$i][0] =  "System"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                If $list[$i][0] =  "smss.exe"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                If $list[$i][0] =  "csrss.exe"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                If $list[$i][0] =  "winlogon.exe"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                If $list[$i][0] =  "services.exe"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                If $list[$i][0] =  "lsass.exe"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                If $list[$i][0] =  "svchost.exe"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                If $list[$i][0] =  "explorer.exe"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                If $list[$i][0] =  "internat.exe"  Then ;对比进程是否一样
                        $Process=1
                EndIf
                
                If $Process=0  Then
                        ProcessExists( $list[$i][0] ) ;结束进程
                        MsgBox(0, "", $list[$i][0])
                        $Process=0
                
                EndIf                
Next
我弄了个 关闭不是WINXP系统进程 运行后没有反映 帮忙看看是哪块有问题
发表于 2013-7-18 15:23:32 | 显示全部楼层
缺一句 $Process=0

什么位置 自己思考
发表于 2013-7-18 21:11:07 | 显示全部楼层
回复 1# qq1244521
你的代码应该把 $Process = 0  放在循环里的首行.
但可以考虑另一种判断方法,让代码更简洁点, 我曾经这么试过的:
Local $Pid_Sys = "[System Process]|System|smss.exe|csrss.exe|" &  _
                  "winlogon.exe|services.exe|lsass.exe|svchost.exe|explorer.exe|internat.exe|"
Local $list = ProcessList()
If @error Then
        MsgBox(16, 'err', 'fail to get process list!')
        Exit
Else
        For $i = 1 To $list[0][0]
                If StringInStr($Pid_Sys, $list[$i][0] & '|') Then ContinueLoop
                ProcessClose($list[$i][0]) ;结束进程
                If @error Then
                        MsgBox(16, $list[$i][0], '关闭进程失败,错误码: ' & @error)
                Else
                        MsgBox(64, $list[$i][0], '已成功关闭此进程.')
                EndIf
        Next
EndIf

评分

参与人数 1金钱 +30 收起 理由
fangbaiyu + 30 学习了.谢谢! 看来思路,结构很重要.

查看全部评分

 楼主| 发表于 2013-7-21 15:46:20 | 显示全部楼层
2# 3#  谢谢了 我去研究下
 楼主| 发表于 2013-7-24 20:32:59 | 显示全部楼层
3楼 正解 代码比我的简洁多了
发表于 2013-7-24 21:00:58 | 显示全部楼层
谢谢3楼的代码,非常不错
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-20 18:56 , Processed in 0.081948 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表