Share this page 

Terminate a running program or processTag(s): WSH VBScript


This snippet will terminate all running instances of Notepad.exe.
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer()
Set props = service.ExecQuery _
  ("select name, description from Win32_Process where name = 'notepad.exe'")
num = props.Count
for each notepad in props
   notepad.terminate
next