# running a notebook with a batch file

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:

Export["C:\\Users\\MATTIA\\Desktop\\FIT\\Fam_II\\test.jpg",
Plot[Sin[x], {x, 0, 10}]]


just plots and saves a sin function

-
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
– Chris Degnen May 16 '14 at 18:24