Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Is there a correct way to close Firefox from a .bat file

  • 6 replies
  • 1 has this problem
  • 18 views
  • Last reply by oldchap47

more options

Hi,

I am on windows 10/FF 78.01 and I have a batch file that on closure saves many things to another disk. Recently I added the saving of my Firefox profiles folder. I had read that when exporting/saving this folder one should ensure that Firefox is closed. Is there a tidy way of closing Firefox in my .bat script?

Currently I am using the cmd taskkill /F /IM firefox.exe but I notice that when I reload Firefox it restarts pretty well exactly where it left off rather than starting with my standard set of tabs as defined in my option 'Use current pages'. It's not a big deal but it would nice to know if there is a correct way to close FF that gives the same restart result as when I do a manual hit 'x' /Close n tabs. Thank you


edited to correct the leading lines spaces, to allow content to wrap properly

Modified by the-edmeister

Chosen solution

Thank you FredNcD

Read this answer in context 👍 0

All Replies (6)

more options

oldchap47 said

Hi, I am on windows 10/FF 78.01 and I have a batch file that on closure saves many things to another disk. Recently I added the saving of my Firefox profiles folder. I had read that when exporting/saving this folder one should ensure that Firefox is closed. Is there a tidy way of closing Firefox in my .bat script? Currently I am using the cmd taskkill /F /IM firefox.exe but I notice that when I reload Firefox it restarts pretty well exactly where it left off rather than starting with my standard set of tabs as defined in my option 'Use current pages'. It's not a big deal but it would nice to know if there is a correct way to close FF that gives the same restart result as when I do a manual hit 'x' /Close n tabs. Thank you

Helpful?

more options

If you close Firefox using taskkill, the browser will reload the last session thinking it crashed.
I don't think there is a way to close the browser via a script program.

Helpful?

more options

Bit disappointed if there isn't a way to cleanly save the profile from a batch file. 'Firefox close ' would be a nice feature rather than crashing it. Wonder if I could suggest it as a feature somehow?

Helpful?

more options

Most (decent) 'Win32' applications will shut down cleanly when Windows shuts down. In other words (if they are programmed well, then) they will recognise the signal given by Windows that it is shutting down, and will then proceed to close (while Windows waits a little bit for them to do so). Whether or not FF does so (it ought to) or not I'm not sure. Of course, one could test whether or not it does, simply by leaving FF running and then restarting Windows. If when FF starts up again it does not follow the 'I think I wasn't shut down properly'-behavior then you know that FF does listens to the Windows shutdown signal and behaves accordingly, otherwise not.

You could, most likely, back up your FF profile via your batch file while FF is still running (provided it isn't doing a bunch of things when you do so), and so it may not be necessary to first tell FF to shut down.

Helpful?

more options

If you want to leave feedback for Firefox developers, you can go to the Firefox Help menu and select Submit Feedback... or use this link. Your feedback gets collected by a team of people who read it and gather data about the most common issues.

Helpful?

more options

Chosen Solution

Thank you FredNcD

Helpful?

Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.