Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Batch File to Close and Open Firefox

Posted on 2011-03-09
17
Medium Priority
?
1,302 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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Suggested Courses

971 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