MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: BatchMode

  • To: mathgroup at
  • Subject: [mg52762] Re: BatchMode
  • From: David Bailey <dave at>
  • Date: Mon, 13 Dec 2004 04:21:54 -0500 (EST)
  • References: <cpav5u$is2$>
  • Sender: owner-wri-mathgroup at

nikos wrote:
> Hi,
> I want to run a mathematica notebook (.nb file) from windows console,
> that means in batch mode. I want the result to be exactly the same as
> if i run the notebook from the graphical enviroment. I use the command
> math < file.nb > outputFile.txt and my output differs a lot.
> Inside the .nb already exists the destination file.
> Is it necessary to wtite it in the command line also?
> I want just to run the notebook from the command line. Inside the
> notebook ( exists a command that gives the kind and path of destination
> file )

I don't know of a way to run a notebook in the way you would like, 
however, it is possible to convert a notebook into a .m file using the 
autogeneratedpackage feature. Now you can run the kernel on the 
resultant file. However, it is a bit difficult to put an expression 
involving an explicit string on to the command line, so I renamed the .m 
file to something else - say foo (with no suffix).

Then, to execute the .m file (assuming Mathematica is on your path) 
execute the command:

mathkernel -run Get[ToString[foo]]

If you want the program to terminate when it is finished, you must 
arrange for it to execute Quit[].

Having discovered all that, I think I will find a use that myself!

David Bailey

  • Prev by Date: Re: multiple outputs from a function
  • Next by Date: Re: Iteration of Initial Conditions for required Boundary Value with NDSolve
  • Previous by thread: BatchMode
  • Next by thread: Setting PointSize Globally in Show[GraphicsArray[---]]?