Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!wuarchive!udel!princeton!phoenix!mrwittma From: mrwittma@phoenix.Princeton.EDU (Martin R. Wittmann) Newsgroups: comp.sys.ibm.pc Subject: Changing to and restoring directories in .BAT files Summary: How do I do it? Keywords: directory batch file .BAT Message-ID: <10992@phoenix.Princeton.EDU> Date: 20 Oct 89 21:16:05 GMT References: <6048@gssc.UUCP> Reply-To: mrwittma@phoenix.Princeton.EDU (Martin R. Wittmann) Distribution: usa Organization: Princeton University, NJ Lines: 19 From within a .BAT file, I would like to be able to save the current directory, change to a new directory and then change back to the original directory before exiting the .BAT file. Is there a straight- forward way to do this? NOTE: I have two programs called pushdir and popdir, but they are unsuitable because they leave memory resident stubs at inconvenient memory locataions. For instance, if I want to change to a directory and invoke a TSR removal program and then change back to the original directory, pushdir leaves a stub above the TSR, so it can't be successfully removed. Related batch file questions: can I set an environment variable to the current directory name? Can I write a program which can change an environment variable which is exported back to the parent shell (i.e. so the change does not disappear when the program exits)? Thanks! martin wittmann