Possible Duplicate:
Relative paths for portable notebooks in Mathematica

I have a deep subdirectory structure, and the calculations should always be done in one of the deepest subdirectories. Instead of clicking through it using the SetDirectory command, is it possible to predefine somehow at the very first beginning of the notebook the second deepest subdirectory as a working directory, so that I can choose with SetDirectory just one of the deepest subdirectories?


1 Answer 1


I think you can do this by setting global options:

Navigate to Format >> OptionInspector select Global Preferences and set NotebookBrowseDirectory and NotebookPath

enter image description here

  • $\begingroup$ Hi Jagra, thanks a lot, this would be possible. But, to be more flexible, I would not prefer to change some global settings... $\endgroup$
    – Harald
    Jul 27, 2012 at 15:49
  • $\begingroup$ I do the following: inside the directory I would like to be a working directory, create a blank mathematica notebook, and in your .bashrc or .profile, define a global variable that stores the path to the notebook. From the command line, just type mathematica $pathname/notebookname.nb & and you will have mathematica launch in the correct working directory. You can then populate the notebook. I have tested this in Unix and OS X, and I think something similar might work on Windows. The disadvantage is that this is OS based(and requires you to modify your bashrc)--breaks across machines. $\endgroup$
    – Y.P.
    Jul 27, 2012 at 18:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.