【发布时间】:2015-05-18 05:59:48
【问题描述】:
有没有办法使用批处理脚本并排(垂直平铺)启动两个资源管理器窗口?
如果没有,我如何使用 VBS 来做到这一点?
【问题讨论】:
-
你能告诉我们你在代码方面做了什么吗?
标签: batch-file vbscript
有没有办法使用批处理脚本并排(垂直平铺)启动两个资源管理器窗口?
如果没有,我如何使用 VBS 来做到这一点?
【问题讨论】:
标签: batch-file vbscript
我已通过 Hackoo 修改了上面的 VBS 脚本,以完全按照 OP 的要求进行操作...
脚本中的 cmets 准确解释了它将做什么。
如果两个窗口没有设置到正确的位置,请增加“睡眠”时间并重试。
如果您想要水平分割,请使用“objShell.TileHorizontally”。
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
'*****************************************************
【讨论】:
这可能与您的问题属于同一类别。 :) How can a batch file run a program and set the position and size of the window?
不幸的是,如果没有任何外部第三方软件,这似乎是不可能的。在 VBS 中可能更容易 - 如果是这样,答案应该在链接中。
【讨论】:
试试这个代码:
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
'*****************************************************
【讨论】: