Internet explorer 使用cmd在internet explorer中打开选项卡
我想制作一个cmd批处理文件,在internet explorer窗口中打开3个选项卡 是否已打开internet explorer窗口对我来说并不重要 我有这个commant,但它会在chrome中打开选项卡(我的默认浏览器,不想更改它..) 请帮忙:) ?Internet explorer 使用cmd在internet explorer中打开选项卡,internet-explorer,batch-file,tabs,cmd,Internet Explorer,Batch File,Tabs,Cmd,我想制作一个cmd批处理文件,在internet explorer窗口中打开3个选项卡 是否已打开internet explorer窗口对我来说并不重要 我有这个commant,但它会在chrome中打开选项卡(我的默认浏览器,不想更改它..) 请帮忙:) ? /d开关用于起始目录(我认为与您的情况无关)。第一个参数是标题,在您的情况下,标题将是“C:\Program Files(x86)\Internet Explorer\iexplore.exe”对于左侧的链接,默认程序没有真正指向打开的程
/d
开关用于起始目录(我认为与您的情况无关)。第一个参数是标题,在您的情况下,标题将是“C:\Program Files(x86)\Internet Explorer\iexplore.exe”
对于左侧的链接,默认程序没有真正指向打开的程序。这使用混合批处理文件(使用.cmd
扩展名保存)。在XP中测试,但必须在系统中测试
@if (@this==@isBatch) @then
@echo off
rem search internet explorer
for /f "tokens=1,* delims=_" %%a in ('
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE" /ve
^|find "REG_"
') do for /f "tokens=1,*" %%c in ("%%~b") do set "iexplore=%%d"
rem Start first window instance
start "" "%iexplore%" -new "http://marathon:7040/console/jsp/login/j_security_check?j_username=wc&j_password=12345"
rem Let internet explorer initialize this instance
ping -n 6 localhost > nul
rem Now, load a new set of addresses into the last opened window
cscript //nologo //e:jscript "%~f0" /url:"http://sparta:7040/console/jsp/login/j_security_check?j_username=wc&j_password=12345"
cscript //nologo //e:jscript "%~f0" /url:"http://sparta:7040/console/jsp/login/j_security_check?j_username=wc&j_password=12345"
exit /b
@end //== javascript zone =======================================================
// Values to be used in the Navigate() method
var navOpenInNewTab = 0x0800
, navOpenInBackgroundTab = 0x1000
, navOpenNewForegroundTab = 0x10000;
// Retrieve command line arguments
var url = WScript.Arguments.Named.Item("url");
// Instantiate component to get access to shell
var shellApplication = new ActiveXObject('Shell.Application');
// Retrieve the last window
var windows = new Enumerator(shellApplication.Windows());
var w = null;
while (!windows.atEnd()){w = windows.item(); windows.moveNext()};
// If a window is found, use this window to open the url in a new tab,
// else create a iexplore instance to load the url
if (w){
w.Navigate(url, navOpenInBackgroundTab, '_blank');
} else {
with (new ActiveXObject('WScript.Shell')){
Run('"'
+ RegRead('HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE\\')
+ '" -new "' + url + '"'
)
}
};
// Let everything initialize before exit
WScript.Sleep(500);
终于在IE中成功了!用VB脚本!!将其保存在.vbs文件中:
Const navOpenInBackgroundTab = &H1000
site1 = "(write your site here)"
site2 = "(write your site here)"
site3 = "(write your site here)"
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.Navigate2 site1
oIE.Navigate2 site2,navOpenInBackgroundTab
oIE.Navigate2 site3,navOpenInBackgroundTab
Set oIE = Nothing
我已经为.bat文件提供了一些代码,这些文件应该可以实现您正在寻找的功能 使用方法:将代码复制到记事本窗口,另存为MyFile.bat或以.bat结尾的其他文件名,然后双击要运行的文件 要使用1个窗口和3个单独的选项卡打开Internet Explorer,请执行以下操作:
:: n pings take n-1 seconds
start "C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
ping 127.0.0.1 -n 2 > nul
start "C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
ping 127.0.0.1 -n 2 > nul
start "C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
要使用1个窗口和3个单独的选项卡打开Internet Explorer(可选):
要使用3个单独的窗口打开Internet Explorer,请执行以下操作:
"C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
"C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
"C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
测试了它,但它打开了internet explorer的3个不同窗口。我想打开一个带有3个不同浏览器的internet explorer窗口tabs@Erez-检查internet explorer设置->不工作。您的代码打开3个不同的窗口,而不是选项卡。在2台计算机上测试,带有IE9和IE11@Erez-请不要使用
start
仅命令“C:\Program Files(x86)\Internet Explorer\iexplore.exe”“link”
谢谢,但仍会打开3个窗口而不是选项卡
:: n pings take n-1 seconds
start "C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
ping 127.0.0.1 -n 2 > nul
start "C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
ping 127.0.0.1 -n 2 > nul
start "C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
:: timeout n lasts between n-1 and n seconds
start "C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
timeout 2
start "C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
timeout 2
start "C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
"C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
"C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"
"C:\Program Files\Internet Explorer\iexplore.exe" "https://www.google.com/"