Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Unable To Pass Arguments to Mathematica Script Through MS-DOS Command Line

  1. Nov 9, 2011 #1
    Hi, guys. I need to write a script in Mathematica that can be called from the Microsoft command line. This script must also take several arguments when called from the command line. My problem is that the instructions for doing this on Mathematica's website are inaccurate. Here's the website:

    http://reference.wolfram.com/mathematica/tutorial/MathematicaScripts.html [Broken]

    Here's the test file I've written (it should just output 2 and then the list of arguments passed to the script through the command line, which is in the variable $ScriptCommandLine by default).

    Code (Text):
    #!/usr/local/bin/MathematicaScript -script

    When I run this script the output gives 1+1=2 and $ScriptCommandLine as an empty list no matter what I seem to do. In other words, I can't seem to pass arguments into my script. Any help would be greatly appreciated. Thank you for your time.
    Last edited by a moderator: May 5, 2017
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted