[comp.os.msdos.programmer] Environment Space

irfan@pluto.dss.com (Syed Mohammad Irfan Ashraf) (04/09/91)

In article <4242@pluto.dss.com> irfan@pluto.UUCP (Syed Mohammad Irfan Ashraf) writes:
>In article <22138@duke.cs.duke.edu> kds@physics.phy.duke.edu (Kevin Stokes) writes:
>>In article <7255@bgsuvax.UUCP> pthonda@bgsuvax.UUCP (Killer B) writes:
>>>
>>> Hi, can you tell me how to increase the environment space in DOS.
>>> System is giving message 'out of environment space' .
>>
>>  This is an easy one.  Just put the following line in your CONFIG.SYS
>>file (or the appropriate variation thereof:)
>>
>>shell=c:\command.com /e:350
>>
>>-Kevin
>
>
>
>Hi guys, I recall an article in one of the pc magazines which described
>how one can patch Command.com to achieve this.


Hello all you there, here goes the article

A BIGGER ENVIRONMENT:
for many users, the default environment size of 160 bytes just isn't enough.
Many programs require optionss placed in the enivronment, and path/prompt
strings keep getting longer and longer. While versions of DOS 3.1 on have
allowed changing the default shell via a SHELL command in the config.sys file,
this doesn't help those who still use earlier versions of DOS. Furthremore the
SHELL command processing itself adds a little additiaonal time to every
boot-up.
Using the information in the following table, you'll find it's simple and quick
to patch COMMAND.COM to enlarge its default envicronment size once and for all.

DOS VERSION		OFFSET
-----------		------

PC-DOS 2.0		0ECF
PC-DOS 2.1		0ECF
PC-DOS 3.0		0F2C
PC-DOS 3.1		0D11
PC-DOS 3.2		0D4F
PC-DOS 3.3		0EB8
PC-DOS 4.0		1C2A

I've tabled all DOS versions from 2.0 to 4.0, so anyone can easily expand to
a modern standard of 512 bytes. Just substitute the correct offset for the
version of DOS you have and follow this example.

C:\>DEBUG COMMAND.COM

-E [offset] 20
-W
-Q

C:\>

For DOS 3.3, the second line would be E 0EB8 20
This should end the "Out of environment space" blues.

DOS references state that the default env. size is 128 for DOS before 3.3 and
160 for DOS ver 3.3 and later. However when I booted with each DOS vers from
2.0 to 4.0 and filled the env. space I found that the size is 160 for all
versions.

Before doing any "surgery" to DOS make sure you have a floppy from which you
can boot if you make a mistake. Also to be doubley sure you're patching the 
right place, check that the byte you are cahnging in fact have the value of
0Ah. 
The command D [0ffset] L 1 will display that byte value.
If it's not 0Ah then either someone has already patched it or you are patching
in the wrong place. Don't try to use these offsets for MS-DOS as they won't
match directly with PC-DOS.
You're not restricted to setting a 512 bytes default env. space. You can get
any size in multiples of 16. Just convert the size to hex, and drop the final
zero.substitue 2F for 20 in example above and you get a 752 bytes environment
space.

-- 
Irfan

=======================================================================
All praises to God; The Sustainer/Lord of all universes.