Contents of the GETPATH.TXT file
GETPATH Ver. 1.0
(c) Copyright 1986,1987
William C. Parke
GETPATH Version 1.0 may be freely copied and distributed as long as
the only charge is for media and reproduction costs. Under no
circumstances should the program be distributed with a commercial
product, sold for profit, or distributed in modified form without
express permission of the author.
GETPATH is a batch file utility to make the current drive index
and path name available to batch files and other programs which
utilize the MS-DOS Environment. The drive and directory are placed
into the Environment Variables DRIV and TREE. These are then
accessible to BAT files by using per cent signs surrounding the
GETPATH requires no command line string. If any character follows
the command, a help display will be sent to the console. GETPATH can
be used any number of times in succession. Each time, the DRIV and
TREE variables are separately redefined. If there is no more
Environment space, GETPATH will generate an ERRORLEVEL=1. If no
directory name is found or the system is in the root directory, then
TREE will be set to the backslash character.
Example fragments from batch file applications are shown below:
Example 1: Display current drive and path:
ECHO Current Drive is %DRIV%:
ECHO Current Directory is %TREE%
Example 2: Saving the current path for later use:
INPUT Give new subdirectory:
ECHO Now in %TREE% directory.
INPUT What file do you wish to edit in this directory?
INPUT Do you wish to stop working? /1
IF %ANS%==N GOTO AGAIN
ECHO Now back in %TREE% directory.
The utility INPUT for console input to a BAT file is available through
CHUG, the Capitol Heath Users' Group in Arlington, Virginia.