Faster way to kill two processes;
Option Explicit
Dim strComputer, objWMIService, colProcess
Dim objProcess
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" _
& "\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery (_
"SELECT * FROM Win32_Process WHERE " _
& "Name = 'ttermpro.exe' OR Name = 'ttpmacro.exe'")
For Each objProcess in colProcess
objProcess.Terminate()
Next
Set objWMIService = Nothing
Set colProcess = Nothing
'Wscript.echo "finish"
\Rems
"Walser Mark" wrote:
> that's the solution:
>
> Option Explicit
> Dim strComputer
> Dim objWMIService
> Dim colProcessList_A
> Dim colProcessList_B
> strComputer = "."
>
> Set objWMIService = GetObject("winmgmts:" &
> "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
> Set colProcessList_A = objWMIService.ExecQuery ("SELECT * FROM Win32_Process
> WHERE Name = 'ttermpro.exe'")
> Set colProcessList_B = objWMIService.ExecQuery ("SELECT * FROM Win32_Process
> WHERE Name = 'ttpmacro.exe'")
> For Each objProcess in colProcessList_A
> objProcess.Terminate()
> Next
> For Each objProcess in colProcessList_B
> objProcess.Terminate()
> Next
>
> Set objWMIService = Nothing
> Set colProcessList_A = Nothing
> Set colProcessList_B = Nothing
>
> 'Wscript.echo "finish"
>
>
>
>
> "Walser Mark"
> news:E70EBC8A-5B81-4208-8CE8-BEE65B7891F5@microsoft.com...
> > hello ng
> >
> > how I can kill a process with a script.
> > I don't know the ID.
> > I know the name of the program: ttermpro.exe
> >
> > thanks
> >
>