HOME WINDOWS DOS FAQ GUESTBOOK CONTACT

Eric Rodda-Software  - Environment Suite Details

 

 PURCHASE NOW only 99 cents


Introduction.

This series of DOS based programs is designed to assist the batch
file programmer and LAN managers in processing data and information.

All of the programs work in the special area of memory, put aside
for our use, called the ENVIRONMENT.

This webpage will printout nicely over about 11 pages.
The detailed information about each utility in included in ENV.TXT within the download zip file.


Environment Suite Index.

Program Categories
Important messages...
Program Syntax
Program Details
Extra Programs


Program Categories.

The programs can be put into 5 different categories.


System information.
---------------------
System time and date:- TIME2ENV DATE2ENV
Get a file size:- FSIZ2ENV
Current drive:- DRV2ENV
Get drive type:- DTYP2ENV
Screen Character Attributes:- ATTR2ENV

Display type:- DISP2ENV
Dos Version:- DOSV2ENV
Total disk space:- DSPC2ENV
Free disk space:- FSPC2ENV
Disk Volume name:- VOL2ENV
Amount of ENVIRONMENT space used:- ENVINFO

String Manipulation.
---------------------
Creating new variable from part of another:- TRIMENV
Locate/replace a string in an environment variable:- LOCSTENV
Appending string to environment variable:- APENDENV

Environment Manipulation.
----------------------------
Combining environment variables:- COMBENV
Compare environment variables:- COMPENV
Check to see if environment variable is set:- CHECKENV
Copy environment variable:- COPYENV
Check if string is in the PATH:- IPATHENV
Get the length of environment variable:- LENGENV
Set environment variable:- SETENV
Delete environment variable:- DELENV
Show an environment variable:- SHOWENV
Set environment variable to UPPER:- UPPERENV

Maths Manipulation.
---------------------
Mathematical processing:- MATHENV
Random number to the environment:- RANDENV


User Input To Environment.
----------------------------
Get user input from keyboard:- ASK2ENV

Extra Programs
----------------
TWIRL.EXE
SINFO.BAT
GUESS.BAT




Very Important messages - Please Read

* It must be understood that when working with these programs, it is
the MASTER environment which is modified. ie. If you are working in
a DOS shell or from within a windows type setup, these programs will
READ most of the variables in the current copy of the environment,
but MODIFY the MASTER environment. Any changes made to the
MASTER environment are not visible from inside the shell
(during that session). The copy of the environment inside the shell
remains unchanged.
These programs work best in a pure DOS environment.

  Try using ENV2FILE to see what can be accessed and what can't.

* The environment space set aside must be sufficient for your
requirements.
The amount of space used is the combination of the length of the
name given to the environment variable, the = sign, the length of
the environment variable and an unseen terminating character.

eg.

DATE=Wednesday,20-12-95

would take up 24 bytes.
The default space set aside in memory is 256 bytes.
This can be changed by modifying (or adding) a line in the
C:\CONFIG.SYS file.

eg.

SHELL=C:\DOS\COMMAND.COM C:\DOS\ /e:2048 /p

will increase the space allocation to 2048 bytes (2Kb)
(In this case COMMAND.COM is in a DOS directory.)
The value must be between 160 and 32768 and is rounded up to a
multiple of 16 bytes.
Once a change has been made to the CONFIG.SYS file, save it and then
REBOOT the PC for the change to take effect.

* You may find that when using these programs, the environment space
available is not as it should be. This is because when the programs
are running the amount of space available is much reduced. To counter
this effect, the environment variables you want to modify should be
established with dummy variables of the appropriate length before
running the programs.
This is not always required, but it is the safe way to go.

eg. (in a batch file.)

SET DATE=xxxxxxxxxxxxxxxxxxxxxxxx
SET ASKING=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
DATE2ENV DATE
ASK2ENV ASKING


Syntax Of The Environment Suite Programs.

All of the programs use similar syntax and have HELP available
by using the command line switch of /?

eg. MATHENV /?

Any switches shown in square brackets [] are optional and should
be used without the brackets.

There is always a space between the program name and any command-
line options (and a space between command-line options).

Replace CURRENT_ENV_NAME, NEW_ENV_NAME, ENV_NAME etc with your
own variable names, which mean something logical in each case.
Remember to keep them short to save environment space.

If an error is made in the command-line options, an error message
will usually be presented just above the HELP screen.

In some cases the HELP screen does not appear and the program
just fails to work. Check your command-line carefully against
the HELP screen in this case.

Remember that in many cases the environment variables have to be
set before the programs are run. This can be easily checked using
the DOS:- SET command (without any parameters).

eg. SET


Program Details.



APENDENV - Add STRING to CURRENT_ENV_NAME and save in NEW_ENV_NAME.

Syntax:- APENDENV CURRENT_ENV_NAME NEW_ENV_NAME STRING [/p]

The NEW_ENV_NAME will contain a combination of CURRENT_ENV_NAME
contents and the STRING.
CURRENT_ENV_NAME and NEW_ENV_NAME can be the same one.
/p can be added to prefix the contents of CURRENT_ENV_NAME with
the STRING.




ASK2ENV - Set environment variable from user input.

Syntax:- ASK2ENV ENV_NAME [/c]

The environment variable ENV_NAME will be set to that of the
user input.

The user will type at the cursor and then press <ENTER>.
This input is then stored in the ENV_NAME environment variable.
If the user presses <ENTER> without input the program will exit
with an errorlevel of 1 and the ENV_NAME will not be SET or
modified.

The optional /c will cause all entry to be stored in CAPITALS.




ATTR2ENV - Put current color attributes into environment variables.

Syntax:- ATTR2ENV FORE_ENV_NAME BACK_ENV_NAME

The environment name FORE_ENV_NAME will be set to equal the
foreground color attribute. eg. normally a number from 0 to 15.
The environment name BACK_ENV_NAME will be set to equal the
background color attribute. eg. normally a number from 0 to 7.

The colors are:-
0=Black, 1=Blue, 2=Green, 3=Cyan, 4=Red, 5=Magenta, 6=Brown,
7=Light Grey (Standard White), 8=Dark Grey, 9=Light Blue,
10=Light Green, 11=Light Cyan, 12=Light Red,
13=Light Magenta, 14=Yellow and 15=Bright White.

If either FORE or BACK is not required replace that ENV_NAME with
a comma.



CHECKENV - Checks whether an environment variable has been set.

Syntax:- CHECKENV ENV_NAME

Exits with errorlevel 1 if ENV_NAME not set, errorlevel 0 if set.




COMBENV - Combine CURRENT_ENV_NAME and ENV_NAME_TO_ADD and save in
NEW_ENV_NAME.

Syntax:- COMBENV CURRENT_ENV_NAME NEW_ENV_NAME ENV_NAME_TO_ADD [/p]

The NEW_ENV_NAME will contain a combination of CURRENT_ENV_NAME
contents and the ENV_NAME_TO_ADD.
/p can be added to prefix the contents of CURRENT_ENV_NAME with
the contents of ENV_NAME_TO_ADD (ie. reverses the combining).




COMPENV - Compare two variables, either environment or literal.

Syntax:- COMPENV VARI_1 VARI_2

Exits with:-
errorlevel 1 if VARI_1 > VARI_2
errorlevel 2 if VARI_1 < VARI_2
errorlevel 3 if VARI_1 = VARI_2




COPYENV - Copy one environment variable to another.

Syntax:- COPYENV CURRENT_ENV_NAME NEW_ENV_NAME [/c]

The contents of environment variable CURRENT_ENV_NAME will be copied
to the NEW_ENV_NAME.
/c can be used to force the contents of the NEW_ENV_NAME to be
changed to capitals.




DATE2ENV - Put current date into an environment variable.

Syntax:- DATE2ENV ENV_NAME [/a]

The environment name ENV_NAME will be set to equal the current
date. eg. Monday,29-12-08 .

For American date format ie. Day,Mo-Da-Yr use:- /a




DELENV - Delete environment variable.

Syntax:- DELENV ENV_NAME

The environment variable ENV_NAME will be removed from the MASTER
environment.
If the ENV_NAME is not set as the program begins, an error will be
indicated and the program exits with errorlevel 1.




DIR2ENV - Put current directory into an environment variable.

Syntax:- DIR2ENV ENV_NAME DRIVE

The environment name ENV_NAME will be set to equal the current
directory of DRIVE. For the current directory on the current
drive put 0 (zero)in the DRIVE position.




DISP2ENV - Put the type of Display Controller Card into an
environment variable.

Syntax:- DISP2ENV ENV_NAME

The environment name ENV_NAME will be set to show the type of
Display Controller Card used in the PC.

Valid types will have the first character an M if Monochrome
or a C if Color and the remaining 3 characters may contain:-
MDA - Monochrome display Adapter
CGA - Color graphics adapter
EGA - Extended (Enhanced) graphics adapter
VGA - Video graphics Array
MGA - Multi-color graphics Array
If no video adapter is found ENV_NAME will be set to:- NONE
eg. for Color VGA, ENV_NAME will be set to:- CVGA




DOSV2ENV - Put the DOS version into an environment variable.

Syntax:- DOSV2ENV ENV_NAME

The environment name ENV_NAME will be set to equal the current
DOS version.
The first two charaters represent the major version and last two
show the minor version. eg. DOS version 6.20 will be reported
as 0620.





DRV2ENV - Put current drive letter plus : into an environment
variable.

Syntax: DRV2ENV ENV_NAME

The environment name ENV_NAME will be set to equal the current
drive letter immediately followed by a colon. eg. C:




DSPC2ENV - Put the total diskspace (in bytes) for a designated
drive letter into an environment variable.

Syntax:- DSPC2ENV ENV_NAME DRIVE_LETTER

The environment name ENV_NAME will be set to equal the size of
the drive specified in DRIVE_LETTER (in bytes).
For the current drive use a 0 (zero) in place of the DRIVE_LETTER.




DTYP2ENV - Put the drive/disk type into an environment variable.

Syntax:- DTYP2ENV ENV_NAME DRIVE_LETTER

The environment name ENV_NAME will be set to show the drive/disk
Type of the drive specified in DRIVE_LETTER.
For the current drive use a 0 (zero) in place of the DRIVE_LETTER.

Drive/disk Types are: 360 Floppy 720 Floppy 1.2 Floppy
1.4 Floppy Other Floppy Bernoulli HardDisk RamDisk SubDrive

Unknown Invalid



ENV2FILE - Send contents of environment variable to a file.

Syntax:- ENV2FILE ENV_NAME FILENAME [/a]

WARNING ... If FILENAME exists it will be over written, unless
the optional /a for append is used.




ENVINFO - Determine Environment space used.

Syntax: ENVINFO or ENVINFO /? for help.

This program determines how much of the memory, allocated to the
ENVIRONMENT, has been used, and show the number of variables set.

The total amount allocated is either the default value of 256 bytes,
or changed by modifing (or adding) a line in the CONFIG.SYS file.

eg.

SHELL=C:\DOS\COMMAND.COM C:\DOS\ /e:2048 /p

will increase the space allocation to 2048 bytes (2Kb)
(In this case COMMAND.COM is in a DOS directory.)

Once a change has been made to the CONFIG.SYS file, save it and
then REBOOT the PC for the change to take effect.




FILE2ENV - Set environment from file contents.

Syntax:- FILE2ENV ENV_NAME FILENAME [/c]

The environment name ENV_NAME will be set to equal the contents
of the first line of the file FILENAME.
If a third argument:- /C is added the contents of ENV_NAME will
be converted to upper case.




FSIZ2ENV - Set environment from file size.

Syntax:- FSIZ2ENV ENV_NAME FILENAME

The environment name ENV_NAME will be set to equal the size
(Bytes) of the file FILENAME.




FSPC2ENV - Put the free diskspace (in bytes) for a designated
drive letter into an environment variable.

Syntax:- FSPC2ENV ENV_NAME DRIVE_LETTER

The environment name ENV_NAME will be set to equal the free space
on the drive specified in DRIVE_LETTER (in bytes).
For the current drive use a 0 (zero) in place of the DRIVE_LETTER.





IPATHENV - Check if a specified drive/directory path is in the PATH
in the environment.

Syntax:- IPATHENV SPECIFIED_PATH

eg. IPATHENV c:\dos or IPATHENV \dos

If the SPECIFIED_PATH is found in the PATH, the program exits
with an errorlevel of 0. If not found, the program exits with
an errorlevel of 1.
The search is not case sensitive.




LENGENV - Checks the length of an environment variable and sets the
new environment variable to match.

Syntax:- LENGENV CURRENT_ENV_NAME NEW_ENV_NAME

Exits with errorlevel 1 if CURRENT_ENV_NAME not set.




LOCSTENV - Locate one string in one environment variable and replace
it with another string, saving the result in another
environment variable.

Syntax:-

LOCSTENV CURRENT_ENV_NAME NEW_ENV_NAME FIND_STRING REPLACE_STRING [/c]


FIND_STRING and/or REPLACE_STRING can be environment variables or
literals.
CURRENT_ENV_NAME and NEW_ENV_NAME may be the same one.
If a , is placed in the REPLACE_STRING position, the FIND_STRING
is simply removed from the result in NEW_ENV_NAME.
/c can be added so that search is case sensitive.
Errorlevel 1 is given if FIND_STRING not found.
NOTE:- Only the first match found will be replaced. Repeat for
multiple searches.




MATHENV - Produce new numeric environment variable from a current
numeric variable, using Addition, Subtraction, Multiplication or Division.

Syntax:- MATHENV CURRENT_ENV_NAME NEW_ENV_NAME A|S|M|D VALUE [/z] [/i]

The contents of the ENV_NAMES, and VALUE must be numeric (up to 18
digits) The VALUE may contain decimals but ...
the result in NEW_ENV_NAME will be rounded to a whole number.
Both ENV_NAMES may be the same one.
VALUE may be an environment variable containing a number or a
literal number.
If a parameter of /z is added, then the length of the NEW_ENV_NAME
value will be the same as the length of the CURRENT_ENV_NAME value.
(or greater if overflow into next decade.) Padding is with leading
zeros.
If a parameter of /i is added, then no rounding is performed.
(Integer only).
Note:- The | represents OR. (ie. the letter A or S or M or D)
A=Add, S=Subtruct, M=Multiply and D=Divide.
Example: MATHENV Counter Counter A 1 (will increment COUNTER)




RANDENV - Stores a random number between (and can include) MIN and
MAX into the environment variable ENV_NAME.

Syntax:- RANDENV ENV_NAME MIN MAX

MIN and MAX may be environment variables set to numeric values or
they may be literal numbers; eg 2 20 or MIN 100 or 1 MAX or MIN MAX.
The value of MIN and MAX should be kept below 60000.




SETENV - Set environment variable from command line.

Syntax:- SETENV ENV_NAME ENV_VALUE

The environment variable ENV_NAME will be set to that of ENV_VALUE.

This program has the special ability of being able to set the
environment to a single space.
To do this use:- SETENV ENV_NAME ~ and the tilde character
will be replaced with a space in the environment variable ENV_NAME.
If a single tilde character (~) is required,
use:- SETENV ENV_NAME ~~ and the environment variable ENV_NAME
will then contain ~ .
ENV_VALUE can contain up to 15 words separated by spaces.
Quotes are not required.




SHOWENV - Show contents of environment variable at current cursor
position.

Syntax:- SHOWENV ENV_NAME [/b]

Exits with errorlevel 1 if ENV_NAME not set.

Using /b will put the contents inside square brackets.




TIME2ENV - Put current time into an environment variable.

Syntax:- TIME2ENV ENV_NAME

The environment name ENV_NAME will be set to equal the current time.
eg. 05:24:14 pm .




TRIMENV - Take an environment variable contents and put part of it
into another environment variable.

Syntax:-

TRIMENV CURRENT_ENV_NAME NEW_ENV_NAME START_CHAR NUMBER_CHARS [/r] [/c]

Both ENV_NAMES can be the same one.
START_CHAR represents the character position number to start with,
beginning with 1.
NUMBER_CHARS represents the number of characters to extract,
starting with the START_CHAR, then to the right (even with /r)."

The program will only work with legal values of the above.
/r will reverse START_CHAR order. (Starts from right end of
contents instead of from the left)
/c can be added to convert the result to UPPERCASE if required.





UPPERENV - Convert an environment variable contents to UPPER CASE
if applicable.

Syntax:- UPPERENV ENV_NAME




VOL2ENV - Put the Volume ID Label (if any) into an environment
variable.

Syntax:- VOL2ENV ENV_NAME DRIVE_LETTER

The environment name ENV_NAME will be set to equal the Volume ID
Label of the drive specified in DRIVE_LETTER. If there is no Label,
then the ENV_NAME will contain:-
[No label] and the errorlevel will be set to 1 on exit.
For the current drive use a 0 (zero) in place of the DRIVE_LETTER.


Extra Programs


TWIRL.EXE

Included in this series is TWIRL.EXE which can be included in batch
file loops or sections to show progress. This program presents a
spinning wheel in the top right corner of the screen. Each time the
program is run the character changes to the next in the series. The
first character is the extended ASCII character | (alt 179), then
the /, then (alt 196), then \. This process is repeated over and
over as required. Once this is no longer needed the TWIRL /off
command should be given to clear the character from the screen.
To perform this process an environment variable is created then
updated each time the program is run.



SINFO.BAT and GUESS.BAT

These batch files are included to show two examples of the programs
in action.

SINFO.BAT gathers data about the PC and then displays it on screen.
As it gathers the data TWIRL is used to show progress.

GUESS.BAT is a number guessing game.

Study these batch files to see how to use the programs in real
situations.
 

 PURCHASE NOW only 99 cents


For Healthy Living

Web Site By WebPageOz