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.
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.
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.
Does anybody have any ideas?
Here is the .bat file:
@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.)
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.)
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.
Thanks for any tips
Maybe it's because of the explorer version? Have you tried reinstalling it? The script works for me also on Win XP SP3, IE7.