Hi,
You can evaluate your notebook from the command line with a
procedure such as this.
Assuming your working directory is C:\temp\plot demo
create a text file C:\temp\plot demo\runplot.m containing this:
Needs["JLink`"];
$FrontEndLaunchCommand = "Mathematica.exe";
UseFrontEnd[
selected = Select[Notebooks[],
CurrentValue[#, NotebookFileName] === "1.nb" &];
If[selected != {},
targetnotebook = First@selected;
SelectionMove[targetnotebook, All, Notebook];
SelectionEvaluate[targetnotebook];
];
Exit[]];
Now to open your file from the command line. I first put
Mathematica on the search path, just for the session (using
setlocal). So, at the command line type or paste:
setlocal
PATH = C:\Program Files\Wolfram Research\Mathematica\8.0\;%PATH%
mathematica "C:\temp\plot demo\1.nb"
(Your DOS command "> 1.nb" did not work for me, so I used
mathematica "C:\temp\plot demo\1.nb")
Now you can evaluate the notebook with this command:
start MathKernel -noprompt -initfile "C:\temp\plot demo\runplot.m"
In case this is of interest, here are some references where
I have discussed similar applications on StackOverflow:-
Evaluating a notebook from the command line
http://tinyurl.com/evalnotebook
About kernel warning message from UseFrontEnd
http://tinyurl.com/uncaughtthrow
Starting and restarting kernels
http://tinyurl.com/restartkernel