I have a notebook that I also execute as a m file on the command line.
Depending on whether I run the notebook or the m file, I want to use slightly different commands.
NotebookDirectory in the nb file should be replaced by
Directory in the m file.
Is there a way to read out how Mathematica was started (on the command line or as a notebook) so that I can use the same file to handle the two different situations?
Other solutions are welcome.