并排启动两个Explorer窗口

时间:2015-05-18 05:59:49

标签: batch-file vbscript

有没有办法使用批处理脚本并排启动两个资源管理器窗口(垂直平铺)?

如果没有,我怎么能用VBS做到这一点?

3 个答案:

答案 0 :(得分:2)

我已经通过 Hackoo 对上面的VBS脚本进行了修改,以完全符合OP的要求......

剧本中的评论准确地解释了它的作用 如果两个窗口没有设置到正确位置,请增加“睡眠”时间并再试一次 如果要进行水平拆分,请使用'objShell.TileHorizo​​ntally'。

Option Explicit
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Launches two Explorer windows side-by-side filling the screen dimensions.
''' Minimizes all current open windows before launch; if this is not done,
''' the current open windows will also be resized along with our two windows.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Dim Calc,AppData,objShell
Calc = "%windir%\system32\calc.exe"
AppData = "%AppData%"
Set objShell = CreateObject("shell.application")

objShell.MinimizeAll
Call Explore(Calc)
WScript.Sleep 800
Call Explore(AppData)
WScript.Sleep 800
objShell.TileVertically
Set objShell = nothing

'*****************************************************
Function Explore(Path)
    Dim ws
    set ws = CreateObject("wscript.shell")
    Explore = ws.run("Explorer /n,/select,"& Path &"")
End Function
'*****************************************************

答案 1 :(得分:0)

这可能与您的问题属于同一类别。 :) How can a batch file run a program and set the position and size of the window?

不幸的是,如果没有批量的任何外部第三方软件,它似乎是不可能的。在VBS中可能更容易 - 如果是这样,答案应该在链接中。

答案 2 :(得分:0)

试试这段代码:

Option Explicit
Dim Calc,AppData
Calc = "%windir%\system32\calc.exe"
AppData = "%AppData%"
Call Explore(Calc)
Call Explore(AppData)
'*****************************************************
Function Explore(Path)
    Dim ws
    set ws = CreateObject("wscript.shell")
    Explore = ws.run("Explorer /n,/select,"& Path &"")
End Function
'*****************************************************