strPName = "notepad.exe"
strComputer = "."
Set objShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
strComputer = "."
Set objShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strPName & "'")
("Select * from Win32_Process Where Name = '" & strPName & "'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
objProcess.Terminate()
Next
WScript.Sleep 2000
objshell.Run "c:\windows\system32\notepad.exe"
————————————————————————————
注: strPName为进程名
objshell run 为进程路径
来源:oschina
链接:https://my.oschina.net/u/4357969/blog/4872213