Solved

Batch File to Close and Open Firefox

Posted on 2011-03-09
17
1,193 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 500 total points
Comment Utility
taskkill /f firefox.exe to close firefox
0
 
LVL 9

Expert Comment

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

Author Comment

by:grantballantyne
Comment Utility
Thanks

This does close firefox - however firefox remembers the tabs that were open
0
 
LVL 9

Accepted Solution

by:
Timothy McCartney earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 4

Expert Comment

by:GeoffHarper
Comment Utility
Correction:

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

Author Comment

by:grantballantyne
Comment Utility
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
Comment Utility
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
Comment Utility
You can then specify from the shortcut which page will be loaded. See attached image.

 Firefox Shortcut
0
 
LVL 4

Expert Comment

by:GeoffHarper
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now