home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
info
/
dostips4.arc
/
DOSENVN.TXT
< prev
next >
Wrap
Text File
|
1986-06-28
|
7KB
|
119 lines
For a Greener Environment
(PC Magazine Vol 5 No 4 Feb 25, 1986 PC Tutor)
You may encounter the "Out of Environment Space" error message
when using the SET command to set up the environment. The DOS manual
mentions a limit of 127 bytes if a resident program has been loaded,
but even without using any resident programs, you may have the problem.
If you have not loaded any resident programs, the DOS manual is
correct: you can sit at your keyboard all day and enter multitudes of
SET commands, gradually filling up your environment to its 32K-byte
maximum limit. Of course, normal people don't do that. Normal people
put a PATH command, a PROMPT command, and a bunch of SET commands in
an AUTOEXEC.BAT file. The whole purpose of batch files is to avoid
having to type a lot of commands manually. But, as soon as you run an
AUTOEXEC.BAT file, the environment becomes limited to 160 bytes.
When COMMAND.COM runs a batch file, it allocates a small area of
memory to store the batch file name and other information. This is
needed to return to execution of the batch file after running commands
and programs within the batch file. For AUTOEXEC.BAT, this area of
memory is placed 160 bytes after the beginning of the environment that
COMMAND.COM maintains. Thus, it acts like a brick wall, effectively
preventing the expansion of the environment beyond 160 bytes.
DOS 3.1 does have a way to enlarge the environment. What you
must do is use a CONFIG.SYS file to specify COMMAND.COM as a SHELL.
This is done with a line in the CONFIG.SYS file that reads:
SHELL=COMMAND.COM /P /E:62. Without the /P parameter, COMMAND.COM
would not execute the AUTOEXEC.BAT file. (This is something that goes
back to DOS 2.0.) The /E parameter is new with DOS 3.1. The value
following the colon is the number of 16-byte paragraphs reserved for
the environment. The default is 10 paragraphs (160 bytes) and the
maximum is 62 (992 bytes). (If you set the value below 10 or above 62,
COMMAND.COM will use the default of 10.)
Where can you find this documented? If you load DOS 3.1
COMMAND.COM under DEBUG and unassemble the code beginning at offset
address 0E16, it is obvious.
The DOS environment has yet to be fully exploited. Some compilers
and assemblers search the environment for directories where library and
include files may be found, but the environment can also serve as an
all-purpose configuration file for application programs, as well. An
undocumented feature of DOS 2.0 and above allows environment strings
to be used as replaceable parameters in batch files -- most usefully
in conjunction with the IF statement. For example, if you have a
batch file that must do one of two different things depending upon
whether ANSI.SYS has been loaded or not, you could use SET to create
an environment string with this information: SET ANSI=ON or
SET ANSI=OFF. You could then check for his in a batch file, with the
statement: IF %ANSI%==ON GOTO label. If COMMAND.COM finds ANSI in
the environment, it replaces it with the set string when the batch
file is processed. If ANSI had been set ON, the GOTO is executed; if
set to OFF, the next statement is processed.
This undocumented feature works with DOS versions 2.0, 2.1 and
3.1, but a bug in 3.0 makes COMMAND.COM stop reading the batch file
line after it replaces the parameter.
For Environmentalists
(PC World April 1986 Star-Dot-Star)
DOS generally provides an insufficient amount of environment
string space. Environment string space is a block of memory that DOS
reserves to hold names and parameters, such as COMSPEC = parameter,
PATH = parameter(s), and PROMPT = parameter(s). This arrangement
enables all DOS commands and applications to be "aware" of the current
status of the environment (see the SET command in the DOS manual).
COMMAND.COM can be patched to expand that space, but DOS 3.1 includes
an undocumented parameter that does the job more efficiently.
That parameter is /E:nn, where nn is a decimal value indicating
the number of 16-byte paragraphs to be allocated as environment space.
The minimum value permitted is 10 (160 bytes), the maximum is 62 (992
bytes). To use this feature, put the statement:
SHELL = [d:][path] COMMAND.COM /P/E:nn
into the CONFIG.SYS file on your DOS disk. [d:] and [path] represent
the disk drive and path you want DOS to use when loading COMMAND.COM,
and nn represents the desired number of 16-byte paragraphs to be
allocated to environment space.
When you start the computer, the SHELL command will load
COMMAND.COM using the /E parameter to allocate the specified amount
of environment space and the /P parameter to make COMMAND.COM the
primary command processor.
Note that if you specify an invalid number of paragraphs, you
will not receive an error message; the allocation simply will not take
place. This is an undocumented feature -- use it with caution.
-----------------------------------------------------------------
RAM Disks Take Command
(PC World The Help Screen June 1986)
A user put COMMAND.COM in a RAM disk so that DOS could reload
COMMAND.COM quickly rather than issue the prompt "Insert COMMAND.COM
disk in drive A: and strike any key when ready" or "Invalid COMMAND.COM
in drive A:". The solution for a way to tell DOS that COMMAND.COM was
on drive C: was to issue the command COMMAND C:\ after copying
COMMAND.COM to drive C:. The explanation:
COMMAND.COM is the DOS command processor. It loads automatically
from the default drive - usually drive A: - when you start a computer.
The command COMMAND C:\ causes DOS to load a new copy of COMMAND.COM
from the root directory of drive C:. This secondary command processor
runs under the first. DOS maintains an environment table that stores
the drive, directory, and name of each command processor it loads.
When it needs to reload a particular command processor, it checks the
related environment table to locate the appropriate command processor
file.
While this technique reloads COMMAND.COM from drive C:, it wastes
memory. You don't need to load a secondary command processor. You
only need DOS to use the copy of COMMAND.COM that resides on drive C:.
If you're using DOS 3.0 or later, load it as you before you tried your
solution. Next, copy COMMAND.COM to drive C:. Follow that by typing
SET COMPEC=C:\COMMAND.COM <Enter> to change the environment table.
(You can view the contents of the environment table by typing SET
<Enter>.) DOS will now use the copy of COMMAND.COM in drive C:
whenever it needs to reload the command processor.
In earlier versions of DOS the SET command does not work right.
You can use CMDFIX.COM (PC World July 1985 Star-Dot-Star) instead of
the SET command to change the COMSPEC entry in the environment table.