搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

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

  • 6 回覆
  • 1 有這個問題
  • 559 次檢視
  • 最近回覆由 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

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''

由 the-edmeister 於 修改

被選擇的解決方法

Thank you FredNcD

從原來的回覆中察看解決方案 👍 0

所有回覆 (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
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.

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?

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.

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.

more options

選擇的解決方法

Thank you FredNcD