How do you get your path in Octave (on Windows)?

Basically, yes.

You can add a directory to the search path using addpath(), but as you know, it only exists for the current session and is reset when you restart Octave. If you want a path to survive between sessions, add it to your octaverc, a script file that gets run whenever a new session gets started. Example path to octaverc file is:

C:\Octave\3.2.4_gcc-4.4.0\share\octave\site\m\startup

Since . is in your path by default, Octave will search your current directory for any function files that it needs. Using addpath(pwd) is somewhat useless if you're just going to stay in the same directory. However, there are some cases where it'd be useful, if for example you have a directory that contains your functions, and another one that has the data that you're working on: you could start in the functions directory, do addpath(pwd), and then cd to the data directory while still being able to use your functions.


You can create batch file, which will start Octave with your directory path. Please see example below:

octave-3.6.4.exe -p "C:\MyOctaveDiretory"

 -p means addpath()

addpath(pwd); savepath();

Done.