[comp.windows.ms] Increasing command.com's environment space

sbarr@ic.sunysb.edu (Sanford L Barr) (06/06/90)

In article <6574@vax1.acs.udel.EDU> bill@vax1.udel.edu (William Tsai) writes:
>Does anybody know how to increase the environment space used
>by variables when executing command.com in a window?
>Seems like SHELL= .. /E .. doesn't affect the copy of comman.com
>being executed in a window.
>
>Any help?

I second the request.  I'm getting a measley 530K free even with the
PIF's at -1 -1.  Does anyone know if the new version of 386MAX works
with Win 3.0?


>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>        Bill Tsai        |  bill@vax1.udel.EDU       ..@freezer.it.udel.edu
> University of Delaware  |    ..@sun.udel.EDU        ffo30260@udelvm.bitnet


--
::::::::::::::::: - Sanford L. Barr - ::::::::::::::::::::"Never argue with
  ___-   ARPA: sbarr@libserv1.ic.sunysb.edu    _------  :: a fool.  Most
 ____-   UUCP: ...!cmcl2!sbcs!libserv1!sbarr   _-----   :: people can't tell
_____- ..!rutgers!philabs!sbcs!libserv1!sbarr  _----    :: the difference."

jcmorris@mwunix.mitre.org (Joe Morris) (06/07/90)

In article <6574@vax1.acs.udel.EDU> bill@vax1.udel.edu (William Tsai) writes:
>Does anybody know how to increase the environment space used
>by variables when executing command.com in a window?
>Seems like SHELL= .. /E .. doesn't affect the copy of comman.com
>being executed in a window.

Try the following:

===== Start file 'envirn33.not' =====

This patch changes the default environment size in COMMAND.COM for DOS 3.3
from its IBM-provided value of 160 bytes.

The COMMAND command (both in the SHELL statement in CONFIG.SYS and in
the command which establishes a secondary command processor) accepts
the /E:xxxx parameter, but when a secondary processor is started it
does not honor the size specification of its parent.  This can cause
significant problems if a user invokes functions which require more
environment space than is available while in a secondary command processor
environment.

The patch will work for PC-DOS 3.3 only.  The concept is probably applicable
for other DOS variants and other releases, but the verify code (and possibly
the patch data) will differ.

The value to be changed represents a (two-byte) word containing the size of
the default environment space in paragraphs (16-byte blocks).  Since the
80*86 architecture inverts the sequence, the low-order byte appears first.
The default value is 160 bytes (hex 00A0), so the original data is hex 0A 00;
to patch the file to default to 512 bytes (hex 0200) the data should be
changed to hex 20 00.

Note that the low-order zero is not present.  To summarize:

   For this much space...insert this value...inverted

160 bytes (10 paragraphs)      000A           0A 00
256 bytes (16 paragraphs)      0010           10 00
512 bytes (32 paragraphs)      0020           20 00

The installation script to set a 512-byte default if typed from the console.
Executing this from a file would not show exactly the same material.

C:\> debug command.com
- d eb4 eb9                     (show the data where we will patch)
xxxx:0EB0              C7 06 60 16 - 0A 00                       ......

- e eb8 20                      (make the actual patch)

- w                             (write the file back to disk)
Writing 62DB bytes
- q                             (exit DEBUG)
C:\>

===== end file 'envirn33.not' =====

michaelk@copper.WR.TEK.COM (Michael D. Kersenbrock) (06/07/90)

	Does anybody know how to increase the environment space used by
	variables when executing command.com in a window?  Seems like
	SHELL= .. /E .. doesn't affect the copy of comman.com being
	executed in a window.

	Any help?

What I did to "fix" this, is to put "SET DUMMY=aa . . . aaa" in my
autoexec.bat.  When a new command.com/DOS app. is fired up in Win 3.0,
with a batch file invocation, I put a "SET DUMMY=" line in it to free
that amount of environment space.

--
Mike Kersenbrock
Tektronix Logic Analyzers Division
michaelk@copper.WR.TEK.COM
Aloha, Oregon

bg11+@andrew.cmu.edu (Brian E. Gallew) (06/07/90)

The simplest way is to change the .PIF so that it calls command in the
following manner:

c:\dos\command.com /E:1024

Command.com never looks at the shell statement.  That is only used by
IBMDOS.COM to load up the cammand processor of your choice.  That is why
you are supposed to put a /P in the parameters in your shell statement. 
Without that switch, it is possible to exit from your primary copy of
command.com and hang the system because there is *NO* command processor
running.

Hope this helps.

akm@getafix.cs.uoregon.edu (Anant Kartik Mithal) (06/07/90)

Another solution is to use 4dos, whic is a shareware command.com
replacement. It is available on Simtel20 and its mirror sites. 4dos
adds a whole bunch of things that command.com does not have, has been
completely compatible for me so far. I shell to it from win3, and it
works just fine. You can define very large environment areas in for
your path, set variables and aliases (three separate areas). Works
like a breeze.

kartik

-----------------------------------------------------------------------------
Anant Kartik Mithal					akm@cs.uoregon.edu
Department of Computer Science				akm@oregon.BITNET
University of Oregon					

bwb@sei.cmu.edu (Bruce Benson) (06/07/90)

In article <1990Jun7.051132.14399@cs.uoregon.edu> akm@getafix.cs.uoregon.edu (Anant Kartik Mithal) writes:
>Another solution is to use 4dos, whic is a shareware command.com
>replacement. It is available on Simtel20 and its mirror sites. 4dos
>adds a whole bunch of things that command.com does not have, has been
>completely compatible for me so far. I shell to it from win3, and it
>works just fine. You can define very large environment areas in for
>your path, set variables and aliases (three separate areas). Works
>like a breeze.

One small bug in 4dos is when swapping to windows (not exiting 4dos) and
then back to 4dos will hang your system.  I don't have win 3.0 yet, but
understand it still is a problem, at least in the 286 mode.  Rex Conn,
author of 4dos, is aware of the problem and working on it.  Otherwise,
it is a great program. 

* Bruce Benson                   + Internet  - bwb@sei.cmu.edu +       +
* Software Engineering Institute + Compuserv - 76226,3407      +    >--|>
* Carnegie Mellon University     + Voice     - 412 268 8496    +       +
* Pittsburgh PA 15213-3890       +                             +  US Air Force

akm@cacofonix.cs.uoregon.edu (Anant Kartik Mithal) (06/08/90)

In article <7462@fy.sei.cmu.edu> bwb@sei.cmu.edu (Bruce Benson) writes:
>In article <1990Jun7.051132.14399@cs.uoregon.edu> akm@getafix.cs.uoregon.edu (Anant Kartik Mithal) writes:
>>Another solution is to use 4dos, whic is a shareware command.com
>
>One small bug in 4dos is when swapping to windows (not exiting 4dos) and
>then back to 4dos will hang your system.  I don't have win 3.0 yet, but
>understand it still is a problem, at least in the 286 mode.  Rex Conn,
>author of 4dos, is aware of the problem and working on it.  Otherwise,
>it is a great program. 

For some reason, the problem doesn't happen with my setup. I
frequently open one or more 4dos windows to use its file
management/file name completion, and then "forget" about the windows,
and go back to Win3.0. During a typical "heavy" work schedule, I
typically have two to four dos apps running, of which two on the
average are 4dos. I also believe that Windows loads 4dos everytime it
opens a window for a dos app: I see some of the 4dos start up messages
whenever I launch a dos application.

kartik


-----------------------------------------------------------------------------
Anant Kartik Mithal					akm@cs.uoregon.edu
Department of Computer Science				akm@oregon.BITNET
University of Oregon					

michaelt@microsoft.UUCP (Michael THURLKILL) (06/11/90)

In article <6574@vax1.acs.udel.EDU> bill@vax1.udel.edu (William Tsai) writes:
>Does anybody know how to increase the environment space used
>by variables when executing command.com in a window?
>Seems like SHELL= .. /E .. doesn't affect the copy of comman.com
>being executed in a window.
>
You need to create a .PIF file for command.com. In the 'Optional
Parameters' field, put in /E:xxxx. 
Also, when you spawn a command.com under Windows only the environment
space currently in use will be reserved. Thus if you have specified
/E:1024 in the shell line of config.sys, but you have only defined
256 bytes of environment variables, only 256 bytes will be reserved in
the spawned DOS VM. Use the above method to explicitely reserve the
desired environment space. Likewise, if you run an application that
requires addtional environment space, you create a .PIF with 
command.com as the 'Program Filename', and '/E:xxxx /C xxx.EXE' as 
the 'Optional Parameters.

Mike Thurlkill

Disclaimer: These are my opinions. They should be in no way misconstrued
as being correct or in any way related to my employer.