![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
Windows / DOS command to shut down Firefox
I have an add-on, Auto ShutDown, that works like this; After all downloads are completed, the add-on gives a command to Windows to do one of the following; 1) Shut down the computer, 2) Restart, or 3) Log the user off. These are done by sending a command to Windows to do what I had selected. What I want to know is, is there a command that would shut down Firefox ONLY, leaving the computer running so that other programs can do there jobs. Like virus scan and optimizer programs. The add-on works great, but lacks this command.
Összes válasz (5)
Hello fredmcd-hotmail, use the next commant......but the commant kill firefox, not exactly close it !!!
TASKKILL /F /IM firefox.exe /T
thank you
Módosította: ideato,
Note that if you do not close Firefox properly, but kill the program that you run the risk to corrupt files in the Firefox profile folder.
You can issue the cmd_quitApplication command to quit Firefox: goQuitApplication()
This function also should do it.
- resource://gre/chrome/toolkit/content/mozapps/extensions/extensions.js
function quitFirefox() { var {classes:Cc,interfaces:Ci,utils:Cu} = Components; var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]. createInstance(Ci.nsISupportsPRBool); Services.obs.notifyObservers(cancelQuit, "quit-application-requested", null); if (cancelQuit.data) return; var appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]. getService(Ci.nsIAppStartup); appStartup.quit(Ci.nsIAppStartup.eForceQuit); }
Módosította: cor-el,
I had read about TASKKILL but was not sure it would close a program or just stop it. Thanks for your input.
Thanks for your answer, Cor-el. I know that you have to close a program properly or, as the man says; 'There Will Be ..... Trouble.' The resource you talked about, where / how can I read it? The program you showed, is it a batch file program, or something else? I have written batch programs before, but I don't know how to use the code you wrote. Many Thanks.
This is JavaScript code that must run in Firefox, just like the Auto ShutDown extension.
That is the only way to close Firefox properly.
All other ways to kill the Firefox program will sooner or later lead to problems.