我正在尝试使用以下 VBS 脚本同时关闭多个应用程序,但0x80041017
在For Each
循环行出现错误。它只适用于一个应用程序,但我添加了另一个以终止
strComputer = "."
strProcessToKill1 = "Acrobat.exe"
strProcessToKill2 = "iexplore.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill1 & "' or '" & strProcessToKill2 & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next