<ul id="g60s4"><pre id="g60s4"></pre></ul>
<strong id="g60s4"><nav id="g60s4"></nav></strong>
<ul id="g60s4"></ul>
  • <tr id="g60s4"></tr>
  • 
    
  • 或者

    殺死指定進程名稱的小VBS

    作者:徐小樣 瀏覽:207 發布時間:2018-03-22
    分享 評論 0

    以下是一小段殺死指定進程名字的小vbs,希望對大家有幫助。

    ?

    1

    2

    3

    4

    5

    6

    7

    8

    Function KillProc(strProcName)

    On Error Resume Next

     Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

     Set arrProcesses = objWMIService.ExecQuery( "select * from win32_process where Name ='"&strProcName&"'" )

     For Each proccess In arrProcesses

     proccess.Terminate 0

     Next

    End Function

    VBS命令-進程操作代碼(檢測進程, 結束進程)

    ?

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43

    44

    45

    46

    47

    48

    49

    50

    51

    52

    53

    54

    55

    56

    57

    58

    59

    60

    61

    62

    63

    64

    65

    66

    67

    68

    69

    70

    71

    72

    73

    74

    75

    76

    77

    78

    79

    80

    81

    82

    83

    84

    85

    86

    87

    88

    89

    90

    91

    92

    93

    94

    95

    96

    97

    98

    99

    100

    101

    102

    103

    104

    105

    106

    107

    108

    109

    110

    111

    112

    113

    114

    115

    116

    117

    118

    119

    120

    121

    122

    123

    124

    125

    126

    127

    128

    129

    130

    131

    132

    133

    134

    //檢測進程

    進程名 = "qq.exe"

    返回值 = IsProcess(進程名)

    If 返回值 = True Then

    MessageBox "發現進程"

    ElseIf 返回值 = False Then

    MessageBox "沒有發現進程"

    End If

    //檢測進程 優化后的代碼

    If IsProcess("qq.exe") = True Then

    MessageBox "發現進程"

    Else

    MessageBox "沒有發現進程"

    End If

    //檢測進程組

    進程組 = "qq.exe|notepad.exe"

    返回值 = IsProcessEx(進程組)

    If 返回值 = True Then

    MessageBox "發現進程"

    ElseIf 返回值 = False Then

    MessageBox "沒有發現進程"

    End If

    //檢測進程組 優化后的代碼

    If IsProcessEx("qq.exe|notepad.exe") = True Then

    MessageBox "發現進程"

    Else

    MessageBox "沒有發現進程"

    End If

    //結束進程 前臺執行

    進程名 = "qq.exe"

    Call CloseProcess(進程名, 1)

    //結束進程 后臺執行

    進程名 = "qq.exe"

    Call CloseProcess(進程名, 0)

    //結束進程組 前臺執行

    進程組 = "qq.exe|notepad.exe"

    Call CloseProcessEx(進程組, 1)

    //結束進程組 后臺執行

    進程組 = "qq.exe|notepad.exe"

    Call CloseProcessEx(進程組, 0)

    //實例應用 結束進程 前臺執行 10秒超時

    進程名 = "qq.exe"

    For 10

    Call CloseProcess(進程名,1)

    Delay 1000

    返回值 = IsProcess(進程名)

    If 返回值 = False Then

    Exit For

    End If

    Next

    If 返回值=True Then

    MessageBox "結束進程失敗"

    Else

    MessageBox "結束進程成功"

    End If

    //實例應用 結束進程 前臺執行 優化后的代碼(直到型循環) 有些進程VBS檢測不到 所以先關閉后檢測

    Do

    Call CloseProcess("qq.exe",1)

    Delay 1000

    Loop While IsProcess("qq.exe")=True

    MessageBox "結束進程成功"

    //實例應用 結束進程組 后臺執行 10秒超時

    進程組 = "qq.exe|notepad.exe"

    For 10

    Call CloseProcessEx(進程組,0)

    Delay 1000

    返回值 = IsProcessEx(進程組)

    If 返回值 = False Then

    Exit For

    End If

    Next

    If 返回值=True Then

    MessageBox "結束進程失敗"

    Else

    MessageBox "結束進程成功"

    End If

    //實例應用 結束進程組 后臺執行 優化后的代碼(直到型循環) 有些進程VBS檢測不到 所以先關閉后檢測

    Do

    Call CloseProcessEx( "qq.exe|notepad.exe",0)

    Delay 1000

    Loop While IsProcessEx( "qq.exe|notepad.exe")=True

    MessageBox "結束進程成功"

    //函數 子程序部分代碼

    //檢測進程

    Function IsProcess(ExeName)

    Dim WMI, Obj, Objs,i

    IsProcess = False

    Set WMI = GetObject("WinMgmts:")

    Set Objs = WMI.InstancesOf("Win32_Process")

    For Each Obj In Objs

    If InStr(UCase(ExeName),UCase(Obj.Description)) <> 0 Then

    IsProcess = True

    Exit For

    End If

    Next

    Set Objs = Nothing

    Set WMI = Nothing

    End Function

    //結束進程

    Sub CloseProcess(ExeName,RunMode)

    dim ws

    Set ws = createobject("Wscript.Shell")

    ws.run "cmd.exe /C Taskkill /f /im " & ExeName,RunMode

    Set ws = Nothing

    End Sub

    //檢測進程組

    Function IsProcessEx(ExeName)

    Dim WMI, Obj, Objs,ProcessName,i

    IsProcessEx = False

    Set WMI = GetObject("WinMgmts:")

    Set Objs = WMI.InstancesOf("Win32_Process")

    ProcessName=Split(ExeName,"|")

    For Each Obj In Objs

    For i=0 to UBound(ProcessName)

    If InStr(UCase(ProcessName(i)),UCase(Obj.Description)) <> 0 Then

    IsProcessEx = True

    Exit For

    End If

    Next

    Next

    Set Objs = Nothing

    Set WMI = Nothing

    End Function

    //結束進程組

    Sub CloseProcessEx(ExeName,RunMode)

    dim ws,ProcessName,CmdCode,i

    ProcessName = Split(ExeName, "|")

    For i=0 to UBound(ProcessName)

    CmdCode=CmdCode & " /im " & ProcessName(i)

    Next

    Set ws = createobject("Wscript.Shell")

    ws.run "cmd.exe /C Taskkill /f" & CmdCode,RunMode

    Set ws = Nothing

    End Sub


    日韩免费的视频在线观看香蕉| 思思99re66在线精品免费观看| 日韩精品亚洲专区在线影视| 中文精品久久久久国产网站| 一区国产传媒国产精品| 国产精品一级AV在线播放| 国产精品夜夜春夜夜爽久久小 | 国内精品视频一区二区八戒| 99在线精品视频在线观看| 3d动漫精品啪啪一区二区中文| 高清免费久久午夜精品| 亚洲国产精品嫩草影院| 久久成人影院精品777| 日韩av无码免费播放| 国产精品熟女视频一区二区| 久久久久久亚洲Av无码精品专口| 亚欧无码精品无码有性视频| 精品国产乱码欠欠欠欠精品| 99久热任我爽精品视频| 国产精品无套内射迪丽热巴| 亚洲国产精品日韩在线| 国产精品电影一区| 久久精品亚洲视频| 伊人 久久 精品| 日韩欧美亚洲中文乱码 | 日韩人妻无码免费视频一区二区三区 | 国产日韩精品一区二区在线观看 | 精品99久久aaa一级毛片| 国产精品 综合 第五页| 国产成人精品亚洲| 91久久精品国产91久久性色tv| 精品成人av一区二区三区| www.午夜精品| xxx国产精品xxx| 国产韩国精品一区二区三区| 国产网红主播无码精品| 99re6在线视频精品免费| 日韩国产成人无码av毛片| 久久久一本精品99久久精品36| 99re热精品这里精品| 亚洲精品高清国产一线久久|