简体   繁体   中英

How do I open a link in a new tab in Internet Explorer using a batch file or .ini

I am trying to open a link to a site in Internet Explorer in a new tab but in a pre-existing window. This is being used in a program that, among other things, allows you to click a button on your desktop that will take you to a website. This program (Rainmaker) uses a .ini file for the links, but I believe that it is interchangeable with batch.

This is their code (The only line that actually does anything regarding opening links is the last one):

[MeterEnd6]
meter=image
imagename=end.png
x=487
y=60
imagerotate = -50
antialias=1
LeftMouseUpAction=!execute ["https://mail.google.com"]

If I press the button using this code, it opens with no issues on my default browser, being Firefox. However, no matter what I've tried, I have never been able to successfully open it in a new tab in Internet Explorer.

Try this batch file :

@echo off
Set Vbsfile=%temp%\NewTab.vbs
If exist %Vbsfile% Del %Vbsfile% 
Set URL=http://batch.xoo.it http://www.developpez.net http://www.stackoverflow.com https://www.facebook.com https://www.yahoo.com
Call:OpenNewTab %Vbsfile%
Start /wait %vbsfile%
:OpenNewTab
(
echo Const NewTab = ^&h800
echo Dim objExplorer
echo Set objExplorer = CreateObject("InternetExplorer.Application"^)
echo NavigateIE_Tabs "http://www.google.com",""
)>%~1
For %%a in (%URL%) Do (echo NavigateIE_Tabs "%%a",NewTab >> %~1) 
(
echo '*****************************************************************
echo Sub NavigateIE_Tabs(URL,Arg^)
echo Const NewTab = ^&h800
echo    with objExplorer
echo            .Navigate2 URL,Arg
echo            .AddressBar = 1
echo            .Visible = 1
echo            .ToolBar = 1
echo            .StatusBar = 1
echo    end with
echo End Sub
echo '*******************************************************************
)>>%~1

I can help at batch file. First you need to know where your Internet Explorer is.

Usually it's at "C:\\Program Files\\Internet Explorer\\iexplore.exe"

So you can write like that in batch file :
"C:\\Program Files\\Internet Explorer\\iexplore.exe" "mail.google.com"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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