Solved

Batch File to Close and Open Firefox

Posted on 2011-03-09
17
1,200 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
Several part series to implement Internet Explorer 11 Enterprise Mode
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.

861 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

20 Experts available now in Live!

Get 1:1 Help Now