Re: Mathematica 6.0 math.exe question
- To: mathgroup at smc.vnet.net
- Subject: [mg79464] Re: Mathematica 6.0 math.exe question
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Fri, 27 Jul 2007 05:54:21 -0400 (EDT)
- References: <f89q8u$5pq$1@smc.vnet.net>
Yvon wrote: > I am trying to run math.exe with a .m file in Windows XP. > > The testAuto.m file has the following: > > Integrate[Exp[I\[Pi]x],x] > Plot[Sin[x+Sqrt[2]Sin[x]],{x,0,2\[Pi]}]; > Export["c:\\pods\\testOut.gif",%] > Quit[] > > In the command prompt, I type math.exe -run testAuto.m > > It returns with In[1]:= waiting for me to enter something. > > The testAuto.m file is in the same directory as the math.exe program > (under C:\Program Files\Wolfram Research\Mathematica\6.0) > > It's as if it is not recognizing or reading the .m file. Is the file > not in the correct format? I originally wrote a notebook in the GUI > and did a Save As... file type package (*.m). The resulting file in a > text editor showed that all the lines were converted to comments (* > *), so I deleted all the lines and symbols leaving only the actual > input commands and resaved. I did this after trying the above command > line with the original .m output and received the same result. > > Please help me figure out how to run this from the command prompt. I > would like to write some "routines" in Mathematica to schedule > automatically to run overnight using the Windows scheduler. > > Thanks in advance! > Yvon > > The -run option takes a COMMAND not a file as argument. Furthermore, backslashes and quotes in the command seem to require escaping to make it work. Thus the following worked for me: "c:\Program Files\Wolfram Research\Mathematica\6.0\math.exe" -run Get[\"c:\\maths\\foo.m\"] David Bailey http://www.dbaileyconsultancy.co.uk