Skip to main content
3 of 6
deleted 18 characters in body
rm -rf
  • 89.3k
  • 21
  • 297
  • 479

This is AFAIK not dependent on the OS but how you run Mathematica. If you only run the Kernel in batch mode, it is $Input which you can ask to get a file path of the script just running. It sometimes needs some extra care as it will not always hold the full file name if I remember correctly. I'd start to just print its content in your script and then add/change what's necessary.

As rm-rf has noted there is now (introduced in version 8) $InputFileName which seems to not be affected by the potential problems I mentioned.

Albert Retey
  • 23.6k
  • 60
  • 104