Kill explorer.exe with window name

I am new to programming and now my question is how can I close some explorer.exe windows. My problem is that I have a program that invokes some windows:

Option Explicit

Dim shell, expl1, expl2, expl3, Terminate

Dim uprgExplorer

  set shell = WScript.CreateObject("WScript.Shell")
  set expl1 = shell.exec("C:\WINDOWS\explorer.exe c:\Documents and Settings")
  set expl2 = shell.exec("C:\WINDOWS\explorer.exe C:\WINDOWS\system32\CCM\Cache")
  set expl3 = shell.exec("C:\WINDOWS\explorer.exe c:\SCRIPTS\LOG")

Now I will kill only these 3 windows NOT explorer.exe.

Can someone help me?

Hi,

Matthias

+3
source share
1 answer

You can use the function SendKeysto close explorer windows:

set shell = WScript.CreateObject("WScript.Shell")

set expl1 = shell.exec("C:\WINDOWS\explorer.exe c:\tmp")

MsgBox "Explorer started."

success = shell.appactivate("c:\tmp")
if success then shell.sendkeys "%{F4}" 

You can also watch AutoHotkey , which allows you to record macros and manage windows .

+1
source

Source: https://habr.com/ru/post/1748810/