Category : Batch File Utilities - mostly for DOS
Archive   : DOSENV.ZIP
Filename : SETENV.DOC
SETENV.EXE (Version 1.0)
from PDG Software
Wauwatosa, WI.
SETENV.EXE allows you set an environmental variable to the
standard output of a DOS command. In other words the
variable will be set to whatever you would normally see
printed to the screen.
Usage: SETENV name command /n
Where name is the name of the environmental variable to be
set, command is the DOS command to be executed, and n is
the number of the line from the output to use.
Example 1: Set an environmental variable to the current
working directory.
C>SET
COMSPEC=C:\COMMAND.COM
PATH=C:\DOS;C:\BIN;C:\BIN\PDG
PROMPT=$p$g
C>CD
C:\BIN\PDG
C>SETENV CWD CD
C>SET
COMSPEC=C:\COMMAND.COM
PATH=C:\DOS;C:\BIN;C:\BIN\PDG
PROMPT=$p$g
CWD=C:\BIN\PDG
The first line of this example shows what environmental
variables are set when we start. There are three
variables set COMSPEC, PATH, and PROMPT. We then do a CD
to show the current working directory. Next we use SETENV
to set the environmental variable CWD to the output of the
CD command. Finally we run SET again to show that the
variable has indeed been added to the environment.
Example 2: Set an environmental variable to the 5th line
of a directory listing.
C>SET
COMSPEC=C:\COMMAND.COM
PATH=C:\DOS;C:\BIN;C:\BIN\PDG
PROMPT=$p$g
C>DIR SETENV.*
Volume in drive C has no label
Directory of C:\BIN\PDG
SETENV EXE 20199 1-28-90 2:03p
SETENV DOC 1739 1-28-90 5:23p
2 File(s) 3010560 bytes free
C>SETENV NAME "DIR SETENV.*" /5
C>SET
COMSPEC=C:\COMMAND.COM
PATH=C:\DOS;C:\BIN;C:\BIN\PDG
PROMPT=$p$g
NAME=SETENV EXE 20199 1-28-90 2:03p
This example shows how the SETENV command can be used with
complex commands. The second parameter of the SETENV is
the DOS command to be executed which can be more than one
word if it is enclosed in quotes. Also. this example
shows how to use a line other than the first printed. The
last parameter tells SETENV to use the 5th line of the
output of the DIR command, which in this case is the
directory line for SETENV.EXE.
Example 3: A batch file called EXAMPLE.BAT accompanies this
document. It contains an example showing how SETENV might
be used in a batch file.
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
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/