# How to run a Mathematica program using command line on windows?

I have to run some Mathematica programs on a remote computer running the Windows XP operating system. However, I do not know how to run the program using the command line on this system.

What do I need to do in order to run Mathematica code remotely on Windows XP?

## 1 Answer

As indicated in the documentation, one can access the Mathematica kernel from the command prompt using the command math in Unix/Linux and MathKernel from Mac OS X/ Windows.

If the MathKernel command is not in your PATH variable, you can try one of several things:

1. Enter the full pathname as part of the command
2. Add MathKernel as a PATH variable using the instructions appropriate to your version of Windows. This will generally involve (a) right-clicking on the My Computer icon from the desktop and choosing Properties, then (b) clicking on a tab or button with the word Advanced in its label (it’s the Advanced System Settings link in Vista and later), and then (c) choosing the Environment Variables option.

3. Using the command prompt, navigate to the directory in Windows that stores the Mathematica kernel executable, as described in this page in the Mathematica documentation.

This documentation page collects all the relevant commands together.

There are several relevant tutorials in the documentation, including on use of the text-based interface and a listing of command-line options and environment variables.

• I have tried MathKernel in cmd on Windows. But it said thtat something like "MatheKernel is not a command". How to install the command? – wxg Oct 15 '12 at 4:39
• @wxg MathKernel is not in your PATH variable. Enter the full path name and it will work. – Ajasja Oct 15 '12 at 5:49
• @Ajasja I have tried as you suggested. Can you tell me how to add MathKernel in the PATH variables? So I can simplely use MathKernel. – wxg Oct 15 '12 at 6:37
• As of September 2015, a number of the links to Wolfram pages are no longer valid. I tried to find the correct links to update the answer, but failed miserably. – bobthechemist Sep 2 '15 at 15:38
• WolframKernel aka MathKernel page with command line keys lives here – garej Nov 30 '15 at 16:47