2010-06-07 22 views
3

我是新編程的,現在我的問題是,我如何關閉一些特定的explorer.exe窗口。我的問題是,我有一個程序,調用一些窗口:用windows標題kill explorer.exe

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") 

現在我只會殺死這3個窗口不是explorer.exe。

有人能幫助我嗎?

問候,

馬蒂亞斯

+0

我的意思是,你可以在C#DLL中編碼解決方案,然後從VB腳本調用功能? – 2010-06-07 08:48:31

+0

我不能C#,我只能有點wsh/vb。 你能幫我嗎?非常感謝。 – Sebastian 2010-06-07 08:51:58

回答

1

您可以使用SendKeys函數關閉資源管理器窗口:

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}" 

你可能也想看看AutoHotkey,它允許您記錄宏和manipulate windows

+0

非常感謝你:-)現在它的完美。 – Sebastian 2010-06-07 09:33:00