Dec 192017
 
Retrieves Path and places in environment. Great for batch files.
File GETPATH.ZIP from The Programmer’s Corner in
Category Batch Files
Retrieves Path and places in environment. Great for batch files.
File Name File Size Zip Size Zip Type
GETPATH.COM 516 490 deflated
GETPATH.TXT 2256 1046 deflated

Download File GETPATH.ZIP Here

Contents of the GETPATH.TXT file



GETPATH Ver. 1.0

(c) Copyright 1986,1987
William C. Parke

DISTRIBUTION

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.

DESCRIPTION

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
variable name.

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 OFF
GETPATH
ECHO Current Drive is %DRIV%:
ECHO Current Directory is %TREE%
...

Example 2: Saving the current path for later use:

ECHO OFF
GETPATH
SET ORG=%TREE%
:AGAIN
INPUT Give new subdirectory:
SET NDIR=%ANS%
CD %NDIR%
GETPATH
ECHO Now in %TREE% directory.
DIR *.DOC/W
INPUT What file do you wish to edit in this directory?
SET RUN=%ANS%
ED %TREE%\%RUN%
INPUT Do you wish to stop working? /1
IF %ANS%==N GOTO AGAIN
CD %ORG%
GETPATH
ECHO Now back in %TREE% directory.
:EXIT

The utility INPUT for console input to a BAT file is available through
CHUG, the Capitol Heath Users' Group in Arlington, Virginia.




 December 19, 2017  Add comments

Leave a Reply