2

Following script is working but I would like to gracefully close it instead of terminate.

'Terminate processes

On Error Resume Next

' Define the list of applications by process
applist = "iexplore.exe|winword.exe|excel.exe|powerpnt.exe|calc.exe|wordpad.exe|mspaint.exe|notepad.exe|cmd.exe|chrome.exe"

'  Loop through the split list and close each process found running
For Each app In Split(appList, "|")
   set objProcs=GetObject("winmgmts:\\.\root\cimv2").ExecQuery("select * from Win32_Process where Name= '" & app & "'")
   For Each process In objProcs
      process.Terminate ***(if I use .Quit, it does not run and does not give any error.)***
   Next
Next

wscript.quit()

Something similar to this.

Set objOutlook = CreateObject("Outlook.Application")
objOutlook.Quit
Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
ktm2cali
  • 21
  • 1

0 Answers0