willcha65
willcha65

Reputation: 49

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).

Problem is, the urls are opened in separate IE windows.
Is it possible to just have 2 tabs in 1 window?

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

Upvotes: 1

Views: 1288

Answers (2)

Potato Head
Potato Head

Reputation: 143

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.

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

Upvotes: 0

woxxom
woxxom

Reputation: 73506

Use VBScript code to start a new InternetExplorer.Application and open the tabs using navigate2 method with navOpenInNewTab = 2048 flag:

@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).

Upvotes: 1

Related Questions