Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Windows (7 if needed). I am trying to learn how to write a batch file that EXECUTES a notebook.

This is the batch

@echo off
START "C:\Programmi\Wolfram Research\Mathematica\8.0\MathKernel.exe" test.nb

it opens mathematica, but doesn't executes the notebook. So I tried (in the notebook) to select the cell and:

Cell>Cell properties>Initialization

but still it only opens the notebook.

What am I missing?

The notebook:

 Plot[Sin[x], {x, 0, 10}]]

just plots and saves a sin function

share|improve this question
Put the commands in a plain text file with extension .m and run it from the command line‌​. – Szabolcs May 16 '14 at 17:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.