如何使用VBS编写这样的小脚本

来源:百度知道 编辑:UC知道 时间:2024/06/02 01:15:48
检测是否存在进程A.EXE
如果存在
则启动C:/b.exe
如果不存在 则
弹出对话框警告杀毒软件被意外终结

Dim WMI,Objs,Process,oshell
Set oshell=CreateObject("wscript.shell")
Set WMI=GetObject("WinMgmts:")
Set Objs=WMI.InstancesOf("Win32_Process")

For Each Obj In Objs
Process=Process & Obj.Description & Chr(13) & Chr(10)
Next
Process=LCase(Process)

If InStr(Process,"a.exe") Then
oshell.Run "c:\b.exe"
Else
MsgBox "杀毒软件被意外终结 ",0,"警告"
End If

Set oshell=Nothing
Set WMI=Nothing
Set Objs=Nothing