?
Solved

Batch File to Close and Open Firefox

Posted on 2011-03-09
17
Medium Priority
?
1,272 Views
Last Modified: 2012-05-11
Dear Experts

I have a batch file to launch firefox and open a certain web page (see code below).  I would like to add the necessery to the batch file to first of all close firefox.

I also need firefox to open as a maximised screen (F11)

Any suggestions?

Thanks
start /d "C:\Program Files\Mozilla Firefox" firefox.exe  www.bspc.co.uk

Open in new window

0
Comment
Question by:grantballantyne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 4
17 Comments
 
LVL 9

Assisted Solution

by:Timothy McCartney
Timothy McCartney earned 2000 total points
ID: 35086509
taskkill /f firefox.exe to close firefox
0
 
LVL 9

Expert Comment

by:Timothy McCartney
ID: 35086581
still trying to find the switch to force FF to open maximized...
0
 

Author Comment

by:grantballantyne
ID: 35086608
Thanks

This does close firefox - however firefox remembers the tabs that were open
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 9

Accepted Solution

by:
Timothy McCartney earned 2000 total points
ID: 35086615
Here are a couple of firefox addons that may achieve what you're trying to do:

https://addons.mozilla.org/en-us/firefox/addon/full-fullscreen/
http://www.mouserunner.com/FF_Tips_Full_Screen.html
0
 
LVL 9

Expert Comment

by:Timothy McCartney
ID: 35086630
When you are re-opening firefox, are you using your batch to trigger the requested site? or are you just opening it from a shortcut icon?
0
 
LVL 4

Expert Comment

by:GeoffHarper
ID: 35087043
start /max {firefox path}

to open it maximized.

start /max /wait {firefox path}

if you want the .bat file to wait for firefox to terminate.
0
 

Author Comment

by:grantballantyne
ID: 35087346
Thanks

I have added the /max switch to the script, however this doesnt seem to work?

See code below


taskkill /f firefox.exe 


start /max  "C:\Program Files\Mozilla Firefox" firefox.exe  www.bspc.co.uk

Open in new window

0
 
LVL 4

Expert Comment

by:GeoffHarper
ID: 35087476
Ah!!

When you put something in quotes (for the START command) it thinks it's a window title.

Try this:

start /max  "My Firefox" "C:\Program Files\Mozilla Firefox" firefox.exe  www.bspc.co.uk
0
 
LVL 4

Expert Comment

by:GeoffHarper
ID: 35087491
Correction:

start /max  "My Firefox" "C:\Program Files\Mozilla Firefox\firefox.exe"  www.bspc.co.uk
0
 

Author Comment

by:grantballantyne
ID: 35087726
Thanks Geoff

I have amended the batch file to:

taskkill /f firefox.exe
start /max  "My Firefox" "C:\Program Files\Mozilla Firefox\firefox.exe" www.bspc.co.uk

However it still does not maximise the firefox window?

Thanks
0
 
LVL 9

Expert Comment

by:Timothy McCartney
ID: 35087746
Give this a shot.

1) Create a link (shortcut) to FF.
2) Set the link to open maximized.
3) Open the link from the command line.

0
 
LVL 9

Expert Comment

by:Timothy McCartney
ID: 35087766
You can then specify from the shortcut which page will be loaded. See attached image.

 Firefox Shortcut
0
 
LVL 4

Expert Comment

by:GeoffHarper
ID: 35087784
Sorry, apparently order counts.  Try this:

start "My Firefox" /max "C:\Program Files\Mozilla Firefox\firefox.exe" www.bspc.co.uk
0
 

Author Comment

by:grantballantyne
ID: 35087974
Thanks again Geoff

I have amended the batch file to:

taskkill /f firefox.exe
start "My Firefox" /max "C:\Program Files\Mozilla Firefox\firefox.exe" www.bspc.co.uk

However it still does not maximise the firefox window?



0
 
LVL 9

Expert Comment

by:Timothy McCartney
ID: 35088135
Is creating a shortcut, then using a batch file to run said shortcut not an option for you? I've already successfully opened the page you're trying to reach through the method I've laid out for you.
0
 
LVL 4

Expert Comment

by:GeoffHarper
ID: 35088169
Wow, I just cut-n-pasted

      start "My Firefox" /max "C:\Program Files\Mozilla Firefox\firefox.exe" www.bspc.co.uk

into a .bat file and executed it, and it maximized.

I'm using Firefox 3.0.19 if that makes any difference...
0
 
LVL 9

Expert Comment

by:Timothy McCartney
ID: 35088184
I believe he's referring to the "F11" version of "maximized"...

Based on my research it doesn't look like you can do this desired action, however through the use of addons it is possible to get a very similar result. I've posted some addon candidates in an early comment on this thread.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
This article discusses how to implement server side field validation and display customized error messages to the client.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question