Solved

Batch File to Close and Open Firefox

Posted on 2011-03-09
17
1,224 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 500 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 500 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
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.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

752 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