Welcome to FreeSoftwareServers Confluence Wiki

This is the VBS code that you can call in the batch to open multiple URL's in the same Browser Instance.

Option Explicit
Const navOpenInNewWindow = &h1
Const navOpenInNewTab = &h800
Const navOpenInBackgroundTab = &h1000
Dim intLoop
Dim navFlags      : navFlags = navOpenInBackgroundTab
Dim objIE
    If WScript.Arguments.Count = 0 Then
        WScript.Echo "Missing parameters"
    End If
    set objIE = CreateObject("InternetExplorer.Application")
    objIE.Navigate2 WScript.Arguments(0)
    For intLoop = 1 to (WScript.Arguments.Count-1)
        objIE.Navigate2 WScript.Arguments(intLoop), navFlags
    objIE.Visible = True
    set objIE = Nothing

Here is my example CMD:

::Batch Files use :: for Comments
cscript //nologo "urls.vbs" https://www.google.com https://www.freesoftwareservers.com

Other Reading:

Embed VBS in CMD

Push Current Directory to CMD


  • No labels

1 Comment