IE Automation & Tabs

A comment to one of my other posts asked about how to launch IE and open several additional tabs.

IE7 does not support specifying multiple URLs on the command line, but another way to do this is to use IE Automation to launch IE as an out-of-proc COM server and then call methods such as IWebBrowser2::Navigate2. While you can do this using C++ or any language that supports COM, the easiest is to use Windows Scripting Host.

First, create a 'lanuchie.js' file using your favorite text editor, add the following, and save:

 var navOpenInBackgroundTab = 0x1000;
var oIE = new ActiveXObject("InternetExplorer.Application");
oIE.Navigate2("https://blogs.msdn.com");
oIE.Navigate2("https://blogs.msdn.com/tonyschr", navOpenInBackgroundTab);
oIE.Navigate2("https://blogs.msdn.com/oldnewthing", navOpenInBackgroundTab);
oIE.Navigate2("https://blogs.msdn.com/ericlippert", navOpenInBackgroundTab);
oIE.Visible = true;

Now from the command line you can do:

 wscript.exe launchie.js

to open IE, navigate the first tab, and then open three background tabs.

One caveat: due to some IE features such as Protected Mode you will sometimes observe that the links are opened in an existing IE window.