Re: Simple question sabout setting directory
- To: mathgroup at smc.vnet.net
- Subject: [mg51468] Re: Simple question sabout setting directory
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Tue, 19 Oct 2004 02:55:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 10/17/04 at 9:49 PM, ds2081 at columbia.edu (Daohua Song) wrote: >(1)Everytime i load a math.nb file, i want it to set the directory to >be the same one where the file is. e.g. Once you load c:\math.nb, the >defalut directory will be set to c:. (so i can manage the .nb file >and other data file in the same direcotry ) The following function will return the directory name where the notebook file is stored. NotebookDirectory[]:= DirectoryName@ToFileName["FileName"/.NotebookInformation@EvaluationNotebook[]] I have this as part of my init.m file that gets executed at the start of every session. Then to achieve what you want all I do is SetDirectory@NotebookDirectory[] at the begining of the notebook file I omitted your second question since it deals with how Mathematica runs under Windows. Since I use a Mac, I've no idea how to achieve the desired response with Windows. On a Mac running OS 10.3 what you want can be achieved with Expose. -- To reply via email subtract one hundred and four