'关掉一个进程
Function Killprcgram(Pro)
Set objWMIService = GetObject("winmgmts:")
set objs =objwmiservice.execQuery("select * from Win32_Process where name='" & Pro & "'")
For Each obj in objs
obj.Terminate()
Next
Set objs = Nothing
Set objWMIService = Nothing
End Function
'打开一个进程
Function OpenFile(temp)
Dim Shell
Set Shell = CreateObject("WScript.Shell")
Shell.Run "notepad.exe"+" "+temp
End Function
'看当前有多少进程,并且存入到一个数组里面去
Function test1()
Set a=GetObject("winmgmts:")
SQL="Select * from Win32_process"
Set b=a.execQuery(SQL)
d= b.count
ReDim c(d)
i=0
For Each b In b
c(i)=b.name
MsgBox c(i)
i=i+1
Next
End Function
本文介绍了使用VBS脚本实现进程的操作,包括关闭指定进程、打开文件进程以及获取当前所有进程并将其名称存储到数组中。这些脚本提供了基本的进程管理功能,适用于Windows平台下的任务自动化。

694

被折叠的 条评论
为什么被折叠?



