Dec 122017
 
These are a couple of small utilities designed to add some flexibility in preparing arguments to commands and setting of environment variables. Includes complete C source code.
File RBSETENV.ZIP from The Programmer’s Corner in
Category Batch Files
These are a couple of small utilities designed to add some flexibility in preparing arguments to commands and setting of environment variables. Includes complete C source code.
File Name File Size Zip Size Zip Type
ADDPATH.C 1111 553 deflated
ADDPATH.COM 2746 1849 deflated
CHGPATH.C 1450 630 deflated
CHGPATH.COM 2908 1939 deflated
COMSUB.C 6783 2356 deflated
COMSUB.H 1448 656 deflated
DELPATH.C 1208 557 deflated
DELPATH.COM 2744 1860 deflated
DUP.C 1059 488 deflated
ENVFUNCS.C 5472 2054 deflated
EVAL.C 5567 2238 deflated
EVAL.DOC 1979 844 deflated
EVAL.EXE 20988 12170 deflated
EVAL.NRO 1632 838 deflated
EVAL.PRJ 57 50 deflated
GETSWITC.C 438 246 deflated
INCR.C 2291 1026 deflated
INCR.COM 5190 3318 deflated
INSPATH.C 1425 604 deflated
INSPATH.COM 2930 1953 deflated
MAKEFILE 4914 1564 deflated
POPEN.C 13983 4293 deflated
POPEN.H 130 86 deflated
README 2568 1182 deflated
SETENV.C 3152 1380 deflated
SETENV.DOC 2914 1120 deflated
SETENV.EXE 20530 11912 deflated
SETENV.NRO 2198 1079 deflated
SETENV.PRJ 71 60 deflated
TCCONFIG.TC 1690 434 deflated
UPROMPT.C 2140 969 deflated
UPROMPT.COM 4546 2983 deflated
WILDARGV.C 6498 2420 deflated

Download File RBSETENV.ZIP Here

Contents of the README file


These are a couple of small utilities designed to add some flexibility in
preparing arguments to commands and setting of environment variables
in the MSDOS command.com shell. They are also useful under
4DOS, although they are not so neccessary there.

Eval runs any named command, after wildcard filename expansion,
command substitution, and environment variable substitution.
Since the named command is a sub-process of "eval", setting of environment
variables will not be useful.

Setenv sets an environment variable into the parent environment, after
performing the same substitutions as above. It can be used to
capture the output of any program which writes to stdout. Setenv can
produce environment variables longer than the MSDOS 127 character
command line limit, since the expansion is performed internally.

As examples of using setenv in collaboration with simple programs
that write to stdout, the following are included:
addpath: add a specified directory to the end of the current path

inspath: insert a specified directory into the current path
delpath: delete a specified directory from the current path
chgpath: change a specified directory into something else.
e.g.
setenv PATH `addpath \new\directory`

As examples of using the environment setting routines directly, the
following are included:
incr: increment an integer valued environment variable directly
uprompt: set the variable PROMPT to the current directory, (with forward
slashes instead of backslashes)

Notes:
Command.com 4.01 SET command does not work properly when the
strings get too long. The environment is correct, and is displayed
correctly by other programs which read it. It seems that COMMAND
assumes the strings cannot be more than 127 characters. I don't know about
earlier versions.

4dos uses backquotes for it's own parsing, so you must protect the
command substitutions with enclosing double quotes.

ms_sh (bourne shell clone) does not really need this utility, but if
you use it, it changes what DOS considers to be the environment.
However this is NOT what sh passes on to child processes so it will
not do you much good.

Temporary files used for command substitution are all placed in a
directory pointed to by %TMP (if set). Considerable speed increase
can be gained by making this a RAMdisk. Also, copying the shell
there and pointing %COMSPEC at it will speed things up.

These programs (source code and binaries) are placed in the public domain.

R. Brittain 10/19/90


 December 12, 2017  Add comments

Leave a Reply