I have a .bat file that simply opens up two different browsers and points them to unique links. After it opens up the first browser, it waits a few seconds, then opens up the second browser. What I expect to happen is that the second browser's window will automatically be focused and active. This behavior only happens when I click on the .bat icon in windows.
我有一个.bat文件,它只是打开两个不同的浏览器并将它们指向唯一的链接。打开第一个浏览器后,它会等待几秒钟,然后打开第二个浏览器。我期望发生的是第二个浏览器的窗口将自动聚焦并激活。仅当我单击Windows中的.bat图标时才会发生此行为。
When I run the .bat file from the command line, the second browser window opens, but in the background. This only happens when the first browser is IE - for some reason it doesn't want to relinquish window focus.
当我从命令行运行.bat文件时,第二个浏览器窗口会打开,但在后台。这只发生在第一个浏览器是IE时 - 由于某种原因它不想放弃窗口焦点。
I have tried using flags like /max to make sure the browser is focused but that doesn't help in bringing the window to focus.
我已经尝试使用像/ max这样的标志来确保浏览器是专注的,但这无助于使窗口聚焦。
Does anybody have any ideas?
有人有什么想法吗?
Here is the .bat file:
这是.bat文件:
@echo off
:: start IE
start iexplore http://localhost:9080/tests/test_getLink.html
:: Wait ~3 seconds
@ping 127.0.0.1 -n 4
:: start FF
start firefox -new-window http://localhost:9080/tests/containerTwoWayForm.html?robot=active
(the IE page polls the server for a link and is in a "waiting" state when firefox opens. I Thought this might contribute to the behavior but I don't understand why it runs differently from command line vs just clicking.)
(IE页面轮询服务器以获取链接,并在firefox打开时处于“等待”状态。我认为这可能会导致行为,但我不明白为什么它与命令行运行不同而只是单击。)
I have made sure that only IE as the first browser causes this behavior. Also, it doesn't matter what browser the second on is (chrome, ie, ff.)
我确保只有IE作为第一个浏览器导致此行为。此外,第二个是什么浏览器并不重要(铬,即,ff。)
I have also tried creating a second batch file to start the second browser and calling it from the first .bat, but that didn't help.
我还尝试创建第二个批处理文件来启动第二个浏览器并从第一个.bat调用它,但这没有帮助。
Thanks for any tips
谢谢你的任何提示
1 个解决方案
#1
0
Maybe it's because of the explorer version? Have you tried reinstalling it? The script works for me also on Win XP SP3, IE7.
也许是因为探险家版本?你试过重新安装吗?该脚本也适用于Win XP SP3,IE7。
#1
0
Maybe it's because of the explorer version? Have you tried reinstalling it? The script works for me also on Win XP SP3, IE7.
也许是因为探险家版本?你试过重新安装吗?该脚本也适用于Win XP SP3,IE7。