NB: None of the responses to Programmatically quitting the FrontEnd or running without one? answers the question asked here.


If one runs FrontEndTokenExecute["FrontEndQuit"], Mathematica pops up a dialog about a "running evaluation", etc. This behavior pauses the program's execution indefinitely, which rules out this approach for terminating the front end programmatically.

Is there a way around this?

Acceptable strategies include:

  1. suppressing the dialog altogether;
  2. clicking on its OK button programmatically (though I suspect this may be impossible to do from within the front end session itself);
  3. using some way other than FrontEndTokenExecute["FrontEndQuit"] to programmatically terminate the front end.
up vote 2 down vote accepted

One way to avoid "running evaluation" dialog is to schedule the shutdown using RunScheduledTask:

RunScheduledTask[FrontEndTokenExecute["FrontEndQuit"], 1];

Note that you still have to save all notebooks first, otherwise you will get a "save" dialog.

  • 1
    Thanks! It works even with a 0-second "delay". – kjo Jun 30 '17 at 17:47

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.