我有一点问题:在Windows 7,8和8.1下,我总是使用一点VBScript打开两个文件夹并垂直平铺。
Set objShell = CreateObject("Shell.Application")
objShell.MinimizeAll
Wscript.Sleep 600
objShell.Explore("some folder 1")
objShell.Explore("some folder 2")
Wscript.Sleep 600
objShell.TileVertically
但在Windows 10中,此脚本无法正常运行。
它可以工作,但是在启动时,两个窗口结果在屏幕上垂直平铺而不是在屏幕上,但只在左侧(就像我想在桌面上放置四个窗口一样)。
有人有想法吗?
答案 0 :(得分:0)
问题是 windows 平铺的窗口比你想要的多,除了资源管理器窗口之外,还有脚本提示也平铺了。例如,您可以通过创建 tile.ps1 脚本来解决问题:
Invoke-Item "some folder 1"
Start-Sleep -s 6
Invoke-Item "some folder 2"
Start-Sleep -s 6
(New-Object -ComObject Shell.Application).TileHorizontally()
Exit
并通过 start.vbs 脚本静默运行它:
Dim objShell,objFSO,objFile
Set objShell=CreateObject("WScript.Shell")
Set objFSO=CreateObject("Scripting.FileSystemObject")
scriptdir = objFSO.GetParentFolderName(WScript.ScriptFullName)
strPath = scriptdir & "\tile.ps1"
If objFSO.FileExists(strPath) Then
set objFile=objFSO.GetFile(strPath)
strCMD="powershell -noprofile -executionpolicy bypass -command " & Chr(34) & "&{" &_
objFile.ShortPath & "}" & Chr(34)
objShell.Run strCMD,0
Else
WScript.Echo "Failed to find " & strPath
WScript.Quit
End If