Category : Batch File Utilities - mostly for DOS
Archive   : GETDIR.ZIP
Filename : GETDIR.TXT

 
Output of file : GETDIR.TXT contained in archive : GETDIR.ZIP

GETDIR Ver. 1.0
(c) Copyright 1986
William C. Parke
for CHUG
Capitol Heath Users' Group

GETDIR is a batch file utility to make the current drive index
and directory 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 DIR. These are then
accessible to BAT files by using per cent signs surrounding the
variable name.

GETDIR requires no command line string. If any character follows
the command, a help display will be sent to the console. GETDIR can
be used any number of times in succession. Each time, the DRIV and
DIR variables are separately redefined. If there is no more
Environment space, GETDIR will generate an ERRORLEVEL=1. If no
directory name is found or the system is in the root directory, then
DIR will be set to the period character.

Example fragments from batch file applications are shown below:

Example 1: Display current drive and directory:

ECHO OFF
GETDIR
ECHO Current Drive is %DRIV%:
ECHO Current Directory is %DIR%
...

Example 2: Checking directory from console input:

ECHO OFF
:AGAIN
INPUT Give new subdirectory:
SET NDIR=%ANS%
CD %NDIR%
GETDIR
IF %NDIR%==%DIR% GOTO OK
INPUT Directory not found. Create it? /1
IF %ANS%==Y GOTO MK
GOTO EXIT
:MK
MKDIR %NDIR%
CD %NDIR%
:OK
ECHO Now in %NDIR%
...
:EXIT

The utility INPUT for console input to a BAT file is available through
CHUG at the address below.

Example 3: Back tracing a directory branch:

ECHO OFF
:START
GETDIR
IF %DIR%==. GOTO FIN
SET DT=%DIR%
CD ..
:LOOP
GETDIR
ECHO Now in %DIR%
IF %DIR%==. GOTO FIN
SET DT=%DIR%\%DT%
CD ..
GOTO LOOP
:FIN
ECHO Current directory path is %DT%
CD .%DT%
GETDIR
ECHO Back in %DIR%
...

Comments may be sent to the author via CHUG, Capital Heath Users'
Group, P.O. Box 16406, Arlington, VA 22215-1406.


  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : GETDIR.ZIP
Filename : GETDIR.TXT

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/