🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.pc
Article #5525

Re: where are you after a batch file

#5525
From: Raymond D. Dunn
Date: Thu, 30 Jan 1986 16:15
47 lines
2977 bytes
For those people who made trite comments about the batch file directory
posting, please think a little before hitting 'f'.  If you have to say
"am I missing something", then yes, you probably are.

The problem being solved by the referenced program is how to return to
the directory current at the start of a batch file which does directory
changes, i.e some sort of pushd and popd.

If anyone thinks this can be done with normal commands without it taking
forever, I for one would be very interested in the solution!

This is a common problem in Dos, particularly when calling (sick)programs
in a batch file which do not understand paths, you have to cd to the
directory of the required file, call the program which uses that file, and
then ... what?  The batch file does not know what its initial current
directory was.

The only solution I know using Dos commands and which I regard as an
unacceptable cludge, is to have a file say xx in a known place which
contains only the characters c, d, and space (no terminating return).

The batch file should now look like:

   copy \dd\xx \pp\popd.bat [ copy the "cd " into file popd.bat, where
                              pp is a directory in your PATH (2.1), or
                              use \pp\popd in the call below (3.1).
                              echo  cd  > popd.bat  can not be used
                              because echo always outputs a terminating
                              return ]
   cd >> \pp\popd.bat       [ append the current directory path to the
                              "cd " ]
   .
   .                        [ the required batch file commands which
   .                          include one or more cd's ]
   .
   popd                     [ which executes the cd to the initial directory.
                              note that if commands are require to follow
                              this in the batch file, it should be:
                              command /c popd ]

As an aside, this is another example of the stupid non-consistency of Dos.
The PATH command with no arguments displays(writes) the line PATH=....., 
however cd with no arguments just displays the directory path with no
initial "cd ".

Ray Dunn  ..philabs!micomvax!othervax!ray
Technical Details
Message-ID: <752@othervax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!linus!philabs!micomvax!othervax!ray
References: <440@tekig5.UUCP> <1130@ecsvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/5/84; site othervax.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!linus!philabs!micomvax!othervax!ray
From: ray@othervax.UUCP (Raymond D. Dunn)
Newsgroups: net.micro.pc
Subject: Re: where are you after a batch file
Message-ID: <752@othervax.UUCP>
Date: Thu, 30-Jan-86 11:15:28 EST
Article-I.D.: othervax.752
Posted: Thu Jan 30 11:15:28 1986
Date-Received: Sat, 1-Feb-86 20:18:12 EST
References: <440@tekig5.UUCP> <1130@ecsvax.UUCP>
Reply-To: ray@othervax.UUCP (Raymond D. Dunn)
Organization: Philips Information Systems - St. Laurent  P.Q., Canada
Lines: 47