我需要一个 .vbs 文件来检查特定进程是否处于活动状态并(如果是)终止它。
问问题
6489 次
2 回答
0
和这个线程一样吗?
除了您只需更改以下行:
Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'Process.exe'")
至
Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & strMyProcess & "'")
于 2012-10-20T07:45:43.470 回答
0
myProcess="chrome.exe" 'repleace chrome.exe with your process name
Set Processes = GetObject("winmgmts:").InstancesOf("Win32_Process")
For Each Process In Processes
If StrComp(Process.Name, myProcess, vbTextCompare) = 0 Then 'check if process exist
Process.Terminate() 'kill the process you find
End If
Next
于 2018-09-28T22:48:33.170 回答