【问题标题】:Launch two Explorer windows side-by-side并排启动两个资源管理器窗口
【发布时间】:2015-05-18 05:59:48
【问题描述】:

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

如果没有,我如何使用 VBS 来做到这一点?

【问题讨论】:

  • 你能告诉我们你在代码方面做了什么吗?

标签: batch-file vbscript


【解决方案1】:

我已通过 Hackoo 修改了上面的 VBS 脚本,以完全按照 OP 的要求进行操作...

脚本中的 cmets 准确解释了它将做什么。
如果两个窗口没有设置到正确的位置,请增加“睡眠”时间并重试。
如果您想要水平分割,请使用“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
'*****************************************************

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      【解决方案3】:

      试试这个代码:

      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
      '*****************************************************
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-06-12
        • 2023-03-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-17
        相关资源
        最近更新 更多