On my desktop I create a text file file named in.txt of one line containing exactly
Export["g1.jpg", Plot[x^2,{x,-3,3}]]
When I double left click the mbat.bat file on the desktop it creates files named out.txt and g1.jpg on my desktop and the second file is an image of the plot.
Can you reproduce exactly this, only changing the user name?
You can try making one tiny change at a time to get closer and closer to what you originally had. Test each small change and see if it still works. For example you might be able to change “C:\Users\bill\desktop\in.txt” to just in.txt. You might be able to change “C:\Program Files\Wolfram Research\Mathematica\10.0\math” to just math. Try to determine the simplest set of steps that works for you. Perhaps you will discover what caused your problem in this way.
Someone wrote there are at least a dozen different ways of doing anything in Mathematica. It is perhaps very difficult to document something in Mathematica in a way that every user will quickly and easily understand how to use a feature.
I recommend everyone create a small Mathematica notebook on their desktop. Each time you discover how to get something to work that you might need in the future you append a new cell to your desktop notebook with a good title and your own documentation for the few lines of code that worked. This becomes your own personal help system.
Hi Bill
I am also doing similar thing like running Mathematica script from a bat file, and running it from a Task scheduler.
I tried your above example, it works fine when I double click the mbat.bat file, both “out” and “jpg” files are generated,
however when I run it from Task scheduler, only “out” file is generated, “jpg” file is not generated.
Is there any problem with Mathematica to export graph files from Task scheduler.
Initially I tried to run the *.m file directly from the Task scheduler, it didn’t work so I am trying your method
I am using windows 10.
Please help,
Thanking you
Hi
I wanted to run Mathmetica script from windows task scheduler,
so I created two files,
Test.nb file containing the Mathematica code to export a graph like below