Matthew Williams
Matthew Williams

Reputation: 101

Start multiple Firefox windows (with tabs) and other programs from a batch file

I am trying to produce a .bat file which will start up two Firefox browsers with multiple tabs and some other programs. Using the following will only open the first Firefox browser with the specified tabs, but not open the second (all the applications open without issue). This is what I have at this stage (there is a prompt bit to avoid accidental running):

@echo off
setlocal
:PROMPT
SET /P AREYOUSURE=Are you sure (Y/[N])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO END

start "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" www.site1.com/ site2.com/ www.site3.com/sitepage/
start "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" site4.com site5.com

start "" "C:\Program Files (x86)\PATH TO EXE"
start "" "C:\Program Files\PATH TO EXE"
start "" "C:\Program Files\PATH TO EXE"
start "" "C:\Program Files\PATH TO EXE"

:END
endlocal

The Firefox portion was constructed based on information found on this question

Upvotes: 0

Views: 3219

Answers (1)

LikeTheRock
LikeTheRock

Reputation: 101

I did the same. I removed the prompt and put a shortcut of the .bat in the startup folder(windows).

@echo off
Set URLs='www.mail.google.com www.wunderground.com www.xkcd.com'
Set NewWindow=-new-window
For %%a in (%URLs%) Do (Start /d "%programfiles(x86)%\Mozilla Firefox" Firefox.exe "%%a")
Start /d "%programfiles(x86)%\Mozilla Firefox" Firefox.exe %NewWindow%

exit

Explanation

  • /d to pass the path of the .exe
  • %programfiles(x86)% the (x86) is needed if you are running windows64. Otherwise remove
  • Firefox should default to starting the urls in new tabs. For me the -new-tab parameter actually made new windows of each.

Hope this helps

EDIT: Possibly try putting your URLs in quotes. "url1 url2 url3" That may solve your problem.

Upvotes: 1

Related Questions