How to close/terminate/kill an instance of a application with VBS?
I've tried the following code, suggested on several posts, and it didn´t work.
Set x = GetObject(,"xxx.Application")
x.quit
How to close/terminate/kill an instance of a application with VBS?
I've tried the following code, suggested on several posts, and it didn´t work.
Set x = GetObject(,"xxx.Application")
x.quit
I think I used WMI at one point, and that worked OK - provided the script runs with the access rights required to kill the processes in question (in other words admin rights for system processes, user rights for user context processes - I suppose there could be NT Privileges / NT Rights (system wide privileges) and custom ACL permission settings (access control list - attached to objects) involved as well - the configuration of which might vary from site to site):
Note:
the below script will kill all Notepad.exe processes! (unless access is denied)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
Some Links: