3

I'm new with programing and my question is now, how i can close some specific explorer.exe windows. My Problem is, i have a program that call 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 this 3 windows NOT the explorer.exe.

Can some one help me?

Greetings,

matthias

John Koerner
  • 37,428
  • 8
  • 84
  • 134
Sebastian
  • 494
  • 5
  • 18
  • 34

1 Answers1

1

You could use the SendKeys function to close the 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 might also want to have a look at AutoHotkey, which allows you to record macros and manipulate windows.

Dirk Vollmar
  • 172,527
  • 53
  • 255
  • 316