标题: Robot 为什么不支持for each .... next [打印本页] 作者: lwfwind 时间: 2006-8-2 20:33 标题: Robot 为什么不支持for each .... next ‘通过进程名终止进程
dim strComputer as string
dim objWMIService as object
dim colProcessList as object
dim objProcess as object
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next