2
$\begingroup$

I'm calling mathematica scripts running kernels through a cygwin terminal, which are again executed from c++ code. When I do this a window pops up, prints warnings and errors if there are any, and then disappears when the computation is done.

This gets annoing because the window automatically opens on top of whatever else I'm doing. I've tried to find solutions without any luck - for example this thread gives the answer for some other situations but wouldn't work from cygwin I think.

Any ideas?

EDIT: To clarify: I'm trying to run a Mathematica script from the cygwin terminal without a Mathematica window popping up. That is, I'm running a command in cygwin with something like ./MathKernel -script myScript.m 45 3 where 45 and 3 are parameters in the computation. Everything works fine but a Mathematica window pops up un top of everything and disappears after a little while, something I'd like to avoid.

$\endgroup$
5
  • $\begingroup$ I believe this is a duplicate. If the other thread doesn't answer your question, just let us know. $\endgroup$
    – Szabolcs
    Dec 6, 2013 at 18:40
  • 1
    $\begingroup$ Actually I think this is not a duplicate, at least not for the question linked: he is trying to run a Kernel from C++ code and that isn't covered by the linked question. It could be argued that this isn't a Mathematica specific question as any command line programm run in a cygwin terminal would have the same issues. @jorgen: I think you should ask that at a cygwin or c++ specific forum, or do you have any indication that this ONLY happens for a Mathematica kernel but not for other command line programs? $\endgroup$ Dec 7, 2013 at 11:05
  • $\begingroup$ @Szabolcs: I think neither of the threads answers this question, I've edited it to clarify. I'll try another forum as suggested. $\endgroup$
    – jorgen
    Dec 9, 2013 at 16:26
  • 1
    $\begingroup$ @jorgen It sounds like I misunderstood your question. I thought you were running command line programs form Mathematica, not running Mathematica from the command line. The solution to your problem is to run math.exe, not MathKernel.exe. On Windows there are two kernel executables, one which runs in a standard command window (and shouldn't pop up another window) and one that draws its own command window and will show a separate window. Does this help? Voted to reopen. $\endgroup$
    – Szabolcs
    Dec 9, 2013 at 16:53
  • $\begingroup$ Yes, that works perfectly. Thanks! $\endgroup$
    – jorgen
    Dec 9, 2013 at 17:03

1 Answer 1

4
$\begingroup$

On Windows there are two kernel executables: MathKernel.exe and math.exe.

MathKernel.exe has its own input window, which may show up separately when you start the process from a command window. If you run it in MathLink mode, it may still show as a taskbar button.

math.exe runs in a standard Windows command window. If you start it from within an existing command window it will not pop up a new, separate window.

So just use math.exe to run your script.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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