From: laure on
Hi,

Is it possible to run Mathematica (evaluate cells) with DOS Command? I am working with Mathematica 5.2 and
I would like to launch a batch of Mathematica programs (that hardly can be written in text file as suggested in the batch mode), each program creating different output files (.xls).
No problem to open the Mathematica code from DOS, but I can't achieve running it... Any help?

Thanks in advance!

From: Albert Retey on
Hi,

>
> Is it possible to run Mathematica (evaluate cells) with DOS Command?
> I am working with Mathematica 5.2 and I would like to launch a batch
> of Mathematica programs (that hardly can be written in text file as
> suggested in the batch mode),

I really wonder which secret features of Mathematica you are using that
can not be coded in InputForm and put into a text file :-)

> each program creating different output
> files (.xls). No problem to open the Mathematica code from DOS, but I
> can't achieve running it... Any help?

Search for UsingFrontEnd in the documentation. It will do what I think
is you need. Still you would need to write a .m file to feed to the
Kernel in the batch file, but you could then use all the features of the
FrontEnd concerning Graphics and Export.

If you want to run a notebook file without touching it, I think putting
the following code to a .m file and run it in batch mode should be a
start for what you want to do...

UsingFrontEnd[
nb = NotebookOpen["YourNotebookFile.nb"];
SelectionMove[nb, All, Notebook];
FrontEndTokenExecute[nb, "EvaluateCells"];
]

hth,

albert