When your node script first starts, get the cwd by calling `process.cwd()`. Then on process exit process.chdir() back to it.
Note this is only needed on windows as far as I know. Unix systems do this automatically for child processes. On Thu, Aug 9, 2012 at 8:20 AM, Ben Evans <b...@bensbit.co.uk> wrote: > Hi All, > > I'm looking for some help on how to change the current working directory in > the terminal window the node application was started from. > > For example I'm in ~/Development/ and I run `node changecwd.js /tmp`. When > the script finished running and I execute `pwd` in the terminal window I get > /tmp. > > I've tried a few things I've found across the web but it's all been > executing in a child process. > > Any help would be much appreciated! > > Cheers, > Ben. > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en