How to get running application name by vbscript
<p>I would like to get the name list of running application by vbscript and kill the application by its main window title. Those applications should be listed on <code>Task Manager -&gt; Applications tab</code><br>
<br>
Like this:<br>
<a href="https://i.stack.imgur.com/byCtU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/byCtU.png" alt="enter image description here"></a>
<br>
After searching from web, I found vbscript like <a href="https://msdn.microsoft.com/en-us/library/aa393618(v=vs.85).aspx" rel="nofollow noreferrer">this</a>:<br></p>

<pre><code>'FUNCTION
Function ListProcessRunning()
'This function can report names from
'TaskManager -&gt; Processes
    sComputerName = "."
    Set objWMIService = GetObject("winmgmts:\\" &amp; sComputerName &amp; "\root\cimv2")
    sQuery = "SELECT * FROM Win32_Process"
    Set objItems = objWMIService.ExecQuery(sQuery)
    'iterate all item(s)
    For Each objItem In objItems
        WScript.Echo objItem.Name
    Next
End Function
</code></pre>

<p>This vbscript list all process names which are under <code>Task Manager -&gt; Processes tag</code> like this:<br>
<a href="https://i.stack.imgur.com/3zfw3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3zfw3.png" alt="enter image description here"></a><br>
Which is not what I want.
<br>
<br>
I also found this:<br></p>

<pre><code>'FUNCTION
Function ListApplicationRunning()
'This function can report names from
'TaskManager -&gt; Application

    Set Word = CreateObject("word.application") 
    For Each x In Word.Tasks
        WScript.Echo x.Name
    Next 
    Word.Quit 
    Set Word = Nothing 
End Function
</code></pre>

<p>Which really give me what I want but the problem is the server I am going to run this script has no <code>Word</code> so no <code>word.application</code> for vbscript and I am not able to install one for it.<br>
<br>
My question is how to get the application name and kill the application by that name? I am not sure is it possible to do with vbscript only, may be a combination of <code>vbscript</code> and <code>cmd</code> is also okay.</p>