请问有没有什么脚本之类的可以结束进程的?我在网上找到的都不能运行的
第一个是
On Error Resume Next
strComputer="." Set objWMIService = Get
Object("winmgmts:" _
&& "{impersonationLevel=impersonate}!\\" && strComputer && "\root\cimv2")Set colProcessList
=objWMIService.ExecQuery _
("Select * from Win32_Process Where Name='ilink.exe'")For Each objProcess in colProcessList
objProcess.Terminate()Next
结果说是行2字符17语句没有结束
第二个是
'function:
' list all process or kill one of them
'parameter:
NameorPID process's name or pid
'return:
' true if kill one process, else false
Function KillProcess(NameorPID)
Dim oWMI, oProcs, oProc, strSQL
KillProcess = False
strSQL = "SELECT * FROM Win32_Process"
If NameOrPID <> "" Then
If IsNumeric(NameOrPID) Then
strSQL = strSQL & " WHERE Handle = '" & NameorPID & "'"
Else
strSQL = strSQL & " WHERE Name = '" & NameorPID & "'"
End If
End If
Set oWMI = Get
Object("winmgmts:\\.\root\cimv2")
Set oProcs = oWMI.ExecQuery(strSQL)
For Each oProc In oProcs
If IsNumeric(NameOrPID) Then
oProc.Terminate
WScript.Echo oProc.Name & "(" & oProc.Handle & ") was killed!"
KillProcess = True
Else
WScript.Echo "Name: " & oProc.Name & vbTab & "PID: " & oProc.Handle & _
vbCrLf & vbTab & "Path: " & oProc.ExecutablePath
End If
Next
Set oProc = Nothing
Set oProcs = Nothing
Set oWMI = Nothing
End Function
结果说是行4字符1nameorpid类型不匹配
请大家提出修改意见或是帮我写一个,谢谢拉