home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
util2
/
withlist.lzh
/
SETENV.ZIP
/
README
next >
Wrap
Text File
|
1988-05-29
|
2KB
|
46 lines
Summary: setenv.arc - set environment variable based on user query
Note that this program is probably not portable because it uses a
knowledge of MS-DOS's internal memory management. It may not work with
layered software such as DoubleDOS. Given the UNIX process paradigm
that MS-DOS uses, there is no portable way for a process to change its
parent's environment.
This utility lets a BAT stream solicit values from a user. It works
and it is quick.
Version 1.1 fixes a minor bug in version 1.0.
SETENV 1.1 by Richard Marks
Sets environment variables to a user response (for BAT files)
SETENV <envirn vbl name> <prompt message>
Example:
setenv drv PLEASE ENTER DRIVE TO USE :
The message PLEASE ENTER DRIVE TO USE : is displayed on the console.
The response is set into variable drv for use by the rest of the BAT file.
For example: copy *.FOO %drv%:*.*
If there is a keyword instead of a <message>, SETENV will fill certain system
values into the environment variable:
SETENV <envirn vbl name> %cwd - get current working directory
%drive- get default drive
%dosv - get dos major version
Use %% to represent a single % in BAT files
Multiple sets of arguments can be supplied:
SETENV <vbl> <msg> <vbl> <msg> . . .
ERRORLEVEL is set to 0 if successful, or is set to 1 if a problem.
Possible problems are that the environment variable block cannot be
found or is full. (This version does not expand the environment block.)
Or an invalid keyword is entered.
This routine does properly find and update the environment block of the
parent COMMAND.COM process. It sets the environment block of the innermost
COMMAND.COM if multiple levels of call are involved.