Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!cernvax!chx400!ugun2b!ugsc2a!fisher From: fisher@sc2a.unige.ch Newsgroups: comp.binaries.ibm.pc.d Subject: Re: v08i302: savedir, save current dir and cd (part 01/01) Message-ID: <1990Nov30.110707.325@sc2a.unige.ch> Date: 30 Nov 90 09:07:07 GMT References: <2372@sixhub.UUCP> Followup-To: comp.binaries.ibm.pc.d Organization: University of Geneva, Switzerland Lines: 84 [REPOST, due to NEWS problems] About c.b.i.p's: > Posting-number: Volume 08, Issue 302 > Submitted-by: rxcob@minyos.xx.rmit.oz.au > Archive-name: savedir/part01 > > This is another piece of Austrailian shareware, which saves the > currect directory before going to another. > > author's description: > > SAVEDIR.EXE - Save directory > > Saves the current drive and directory to a batch file which when executed > restores them and deletes itself unless /D (dont delete) is specified. > A .BAT extension is automatically added to the filename if required. > > SHAREWARE: > Registration fee: $20 for Private/Domestic use ($ Australian) > $30 for Professional/Commercial use (" " ) I'd hate to spoil the autralian shareware market, but IMHO, any owner of a decent compiler can write himself such a program. But the problem is one of analysis. I'm no professional either, but this is clearly a case of `let's program first, we'll think later...'. An example: C:\ADM\LETTERS\1990> savedir work [ work.bat is now: @C: @cd \ADM\LETTERS\1990 @del WORK.BAT ] C:\ADM\LETTERS\1990> cd \ C:\> d: D:\> cd \games D:\GAMES> play [... oops, somebody! ... Ctrl-C, quick! ...] D:\GAMES> work Bad command or file name D:\GAMES> c:adm\letters\1990\work [ nice... :-] Hmm. So this is why `pushdir' is often a TSR? But there is another solution. A few years back, after reading the manual TurboC, I wrote a small program, called `write' - now in queue for posting in c.b.i.p -, which simply translates the string on the command-line much like in the `prompt' syntax. Thus my own `savedir' is a batch file: @ write :Saving cwd $_@$n:$_@cd $p > %TMP%`oldir'%2.bat @ if %1~ == -d~ write $_@del %TMP%`oldir'%2.bat >> %TMP%`oldir'%2.bat working with an `oldir.bat': @ if exist %TMP%`oldir'%1.bat %TMP%`oldir'%1 @ echo No directory saved %1 Whenever I need to save the current location (let's say in another batch): call savedir -d x [...] call oldir x Of course TMP must be set, so that I can locate the file from anywhere... `C:\TMP\`oldir'x.bat' is: :Saving cwd @C: @cd C:\ADM\LETTERS\1990 @del C:\TMP\`oldir'x.bat [ is here, not on the next line, of course ] If you inted to use the `savedir.exe', you should also use the same trick (i.e. `savedir %TMP%popdir') to be able to locate the batch file when you need it. Still, watch out for `mfwrite.zoo', as it's *free*, as well as the two batch files above :-) Markus Fischer, Dpt. of Anthropology, Geneva.