i am new to mathematica, and i am trying to run a notebook as batch job(i will elaborate on this later). According to the documentation, running mathematica from command line using the -script parameter will run as batch job. it also mentions .wl files but i dont know how to create them.

this is what i have in the notebook:


as you can see, other than the first i have added some sample plots. when i run this from cmd (i am on windows 10), i run it this way:

C:> "C:\Program Files\Wolfram Research\Mathematica\12.0\math.exe" -script "C:\Users\user\Desktop\Mathematica\final.nb"

and i get only text, and nothing else (no cloud link also). but, if i run it from notebook -> evaluate notebook, i see everything rendered and also i get the cloud link. if needed, i can split the single file to several different files.

so, my questions are:

  1. how to write a simple .wl file (or .m as i understood) to call the different files to execute them in the wl script (if i understood the concept of batch execution in mathematica)?
  2. how to print out also the cloud link when calling it from cli?
  3. probably a stupid question, but: should the cloud link be available when running it from cli?
  • $\begingroup$ Copy your code as simple text and paste it in a text file (say script.wl). Then execute it in a command line with wolframscript -f script.wl $\endgroup$
    – Fortsaint
    Commented Jan 7, 2020 at 14:24
  • 1
    $\begingroup$ In Mathematica "File / Save As..." and select "Wolfram Language Package (*.wl). $\endgroup$ Commented Jan 7, 2020 at 14:28
  • $\begingroup$ Ok, that is the first point. Will it print out the cloud link when running it from cmd? I am currently not in front of my desk to try this out. $\endgroup$ Commented Jan 7, 2020 at 15:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.