---------------- SHAREWARE 1994!!! --- POP & PUSH --- Programmed By Ondrej Blazek ---------------- Need a program that remembers the current directory? Have programs that change the current direcctory and don't change it back? Are you running a batch file which makes use of the current directory but some program in you batch file changes it? Well all is solved with POPD and PUSHD! 1.0 PURPOSE: ------------ The purpose of POPD and PUSHD is to remember and recall directory names. To remember a directory use the PUSHD command. To switch to the remembered directory, use the POPD command. Its that easy! 2.0 STACK FEATURE: ------------------ POPD and PUSHD use a file stack. This means that you can get POPD and PUSHD to remember more than one directory. The stack works like any other stack: Last to come on the stack is the first to leave the stack. Metaphorically this can be imagined as a layer of bricks. Each time PUSHD is used another layer of bricks is added. Each time POPD is used, the last (highest) layer of bricks is removed. For example: You are in the C:\GAMES directory and type PUSHD. The stack looks like this: Top-> C:\GAMES Next you enter the C:\GAMES\PINGPONG directory and type PUSHD. The stack looks like: Top-> C:\GAMES\PINGPONG (Notice the LAST call is on TOP) C:\GAMES Lastly you move to the root directory and enter the C:\TEXT directory. When you type PUSHD, the stack looks like: Top-> C:\TEXT C:\GAMES\PINGPONG C:\GAMES If we switch to the root directory (or any other directory) the first POPD call will place us in the C:\TEXT directory. The next call will place us in the C:\GAMES\PINGPONG directory and the last call will place us in the C:\GAMES directory. Trying to use POPD afterwards will yield in an error message. 3.0 KILLING THE STACK: ---------------------- POPD PUSHD uses a disk file stack. This means that computer crashes or turning off the computer DOES NOT clear the stack. If you would like to clear the POPD PUSHD stack, use POPD with the /KILL paramater. If you wish POPD PUSHD to clear the stack each time the computer is turned on, place the POPD /KILL in your AUTOEXEC.BAT file. 4.0 COUNTING AND/OR DISPLAYING THE STACK: ----------------------------------------- POPD PUSHD also has two other command line parameters which allow the user to either view the stack of directories or count the number of directories on the stack. Using the POPD /COUNT command will display the number of directories on the stack WITHOUT pulling a directory, while the POPD /DISPLAY command will display the directory stack WITHOUT pulling a directory. 5.0 EXAMPLE OF USE: ------------------- The following little program is a very basic FILE FIND routine. To provide a full search of the entire hard drive (C:) the routine needs to start the command in the root directory. To ensure that the user is not left in the root directory, POPD and PUSHD can be used. EDIT FF.BAT @TYPE OFF POPD CD\ DIR %1* /S/B PULLD Notice that this program would work even if there are already directories on the stack, because the PUSHD command will place the current directory on the very top of the stack and right after the DIR command that same directory is POPeD of the stack. 6.0 EXTERNAL FILE: ------------------ POPD PUSHD creates one external file which contains the directory stack. This file will be placed according to the DOS enviromental variable TEMP. If TEMP is not set, the file will be placed in the root directory. This file should not be removed, doing so will cause problems when trying to use POPD PUSHD. ---------------------- - SHAREWARE 1994! - ---------------------- This program is 100% SHAREWARE and can be copied and distributed under the following rules: 1) None of the files may be altered in any way especially, but not limited to, any of the credits (in this file or the main program), notes or the program name. 2) The main program must always be accompanied by this DOC file. 3) And there is to be no fee charged for any copying or distribution of this program excluding shipping and handling charges. Under the SHAREWARE agreement you may preview this program for 30 days with no obligation. If you find POPD PUSHD useful and continue to use it after the 30 day trial period please send a registration fee of $5 to $10 dollars to the address below. With registration users obtain free updates of the registered program and encourage future programming projects. Send your Registration Fee, Comments or Bugs to the Programmer: Ondrej Blazek 847 Ludgate Cr. Kingston, Ontario K7M 6C7 CANADA