Home directory in octave on windows?
Benjamin Lindner
lindnerben at gmx.net
Fri Jun 5 13:22:52 CDT 2009
m h wrote:
> Thanks Michael and Tatsuro. Very interesting. The tip with the HOMEDRIVE
> variable is what got me going.
>
> So I figured out what was going on:
>
> Upon startup, there's no HOME variable in the environment that my Octave
> starts up in.
> And, somewhere in my user profile, apparently someone set up U: as my
> home drive (i.e. the HOMEDRIVE variable). This is apparent when I open
> up a regular cmd command shell, and type "echo %HOMEDRIVE%". (As an
> aside, I haven't figured out where that variable gets set, it's not in
> the registry (regedit) or in the Computer/Properties/Advanced System
> Settings/Environment Variables ... Must have been set somewhere else...)
>
> C:\Users>echo %HOMEDRIVE%
> U:
>
> So for now, I'm stuck with reading an .octaverc in the U: directory. So
> I used that and set up and .octaverc to change the HOME, HOMEDRIVE and
> HOMEPATH variables. That seemed to work. Interestingly enough, now
> Octave reads the .octaverc in the U:\ directory, and then the .octaverc
> in the new HOME path I set. Both get read! Example:
Octave will also read an .octaverc file in the current directory,
perhaps that's the effect you are seeing.
But you need not change your environment after starting octave, you can
simple edit it before starting octave, e.g. by creating a batch file like
@rem set HOME to new location
set HOME=c:\my\home
@rem start octave
c:\path\to\octave\bin\octave.exe
> Content of U:\.octaverc :
>
> printf("HOME before set: %s\n", getenv('HOME'));
> printf("HOMEDRIVE before set: %s\n", getenv('HOMEDRIVE'));
> printf("HOMEPATH before set: %s\n", getenv('HOMEPATH'));
> setenv('HOME','C:\Users')
> setenv('HOMEDRIVE','C:')
> setenv('HOMEPATH','C:\Users')
> printf("HOME now changed to: %s\n", getenv('HOME'));
> printf("HOMEDRIVE now changed to: %s\n", getenv('HOMEDRIVE'));
> printf("HOMEPATH now changed to: %s\n", getenv('HOMEPATH'));
> printf("%s\n","Read .octaverc at U:")
> cd
>
> Content of C:\Users\.octaverc
>
> printf("%s\n","Read .octaverc at C:\\Users")
>
> Output when Ocave starts:
>
> [...]
> For information about changes from previous versions, type `news'.
>
> HOME before set:
> HOMEDRIVE before set: U:
> HOMEPATH before set: \
> HOME now changed to: C:\Users
> HOMEDRIVE now changed to: C:
> HOMEPATH now changed to: C:\Users
> Read .octaverc at U:
> Read .octaverc at C:\Users
> octave-3.0.5.exe:1:~
>>
>
> I used C:\Users as a test directory, I'll change that of course for real
> work...
> If you have any idea how to look for where else (other than the two
> locations I mentioned above) my HOMEDRIVE variable could get set, I'd
> appreciate any information. But that's really a Windows question...
> Otherwise, I can work with the situation as is.
If you are on a network environment, then the home drive is normally set
in your user's profile, or set in your logon script.
Be careful with changing it, though.
>
> Thanks for all the help!
>
> --- Marc
>
>
More information about the Help-octave
mailing list