简体   繁体   English

在一个Internet Explorer窗口中打开几个选项卡

[英]Open several tabs in one Internet Explorer window

I am trying to create a batch script that opens up 2 websites in iexplorer (I need to use IE). 我正在尝试创建一个批处理脚本,该脚本在iexplorer中打开2个网站(我需要使用IE)。

Problem is, the urls are opened in separate IE windows. 问题是,URL是在单独的IE窗口中打开的。
Is it possible to just have 2 tabs in 1 window? 一个窗口中可以只有2个标签吗?

taskkill /im iexplore.exe /f
taskkill /t /f /im chrome.exe
taskkill /t /f /im communicator.exe
ping 127.0.0.1 -n 4
start iexplore.exe http://site1
start iexplore.exe http://site2
start communicator.exe

Use VBScript code to start a new InternetExplorer.Application and open the tabs using navigate2 method with navOpenInNewTab = 2048 flag: 使用VBScript代码启动一个新的InternetExplorer.Application和使用打开的选项卡navigate2navOpenInNewTab = 2048标志:

@echo off
findstr /r /c:"^::[^ ]" "%~dpnx0" > "%temp%\openIEtab.vbs"
cscript //b //nologo "%temp%\openIEtab.vbs"
del "%temp%\openIEtab.vbs"

::set IE = CreateObject("InternetExplorer.Application")
::IE.visible = true
::IE.navigate2 "google.com"
::IE.navigate2 "bing.com", 2048

There are also powershell solutions ( example ). 还有一些powershell解决方案( 示例 )。

Try adding a timeout right after the first website you're trying to open, like this. 尝试在您尝试打开的第一个网站之后添加一个超时,就像这样。 Timeout will wait whatever amount of seconds you set after the /T which might be what you're trying to accomplish with the ping command, unless you need to ping a specific address everytime. 超时将等待您在/T之后设置的秒数,这可能是您要使用ping命令尝试完成的秒数,除非您每次都需要ping一个特定的地址。

taskkill /im iexplore.exe /f
taskkill /t /f /im chrome.exe
taskkill /t /f /im communicator.exe
ping 127.0.0.1 -n 4
start iexplore.exe http://site1
TIMEOUT>NUL /T 3 /NOBREAK
start iexplore.exe http://site2
start communicator.exe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM