[comp.windows.ms] Increasing Environment Space

SLVQC@CUNYVM (Salvatore Saieva) (07/03/90)

I'm running Windows 3.0 in 386 enhanced mode on top of DOS 4.0.
Is there a way to tell Windows to start a Non-Windows application
with a larger environment? Any time I run a batch file (from Windows)
that sets environment variables I get `out of environment space'
errors. The SHELL command in my config.sys is using the /e parameter,
and I have modified the Properties of the DOS Prompt program (in the
Main Windows group) to add /e:1024 to the COMMAND.COM command line
which gives the spawned COMMAND.COM a 1K environment. I can't seem
to find any way to give other Non-Windows applications a larger
environment. Anybody have any ideas?

Sal.
-------
 Salvatore Saieva                            Internet: slvqc@cunyvm.cuny.edu
 Queens College, Academic Computer Center      BITNET: slvqc@cunyvm.bitnet
 65-30 Kissena Blvd, Flushing, N.Y. 11367     DeskNet: (718) 520-7662

steveha@microsoft.UUCP (Steve Hastings) (07/05/90)

In article <90183.141937SLVQC@CUNYVM.BITNET> SLVQC@CUNYVM (Salvatore Saieva) writes:
>Is there a way to tell Windows to start a Non-Windows application
>with a larger environment? Any time I run a batch file (from Windows)
>that sets environment variables I get `out of environment space'
>errors.

Make a PIF file for the batch file you want to run, say "FOO.BAT."  Inside
FOO.PIF, when you specify what to run, instead of saying "FOO.BAT" you
should say "COMMAND.COM /E:1024 /C FOO.BAT".

Note that when you just specify "FOO.BAT" Windows will run a COMMAND.COM
anyway to execute it, so this technique does not cost you anything.
-- 
Steve "I don't speak for Microsoft" Hastings    ===^=== :::::
uunet!microsoft!steveha  steveha@microsoft.uucp    ` \\==|

SLVQC@CUNYVM (Salvatore Saieva) (07/06/90)

In article <55654@microsoft.UUCP>, steveha@microsoft.UUCP (Steve Hastings) says:
>
>In article <90183.141937SLVQC@CUNYVM.BITNET> SLVQC@CUNYVM (Salvatore Saieva)
>writes:
>>Is there a way to tell Windows to start a Non-Windows application
>>with a larger environment? Any time I run a batch file (from Windows)
>>that sets environment variables I get `out of environment space'
>>errors.
>
>Make a PIF file for the batch file you want to run, say "FOO.BAT."  Inside
>FOO.PIF, when you specify what to run, instead of saying "FOO.BAT" you
>should say "COMMAND.COM /E:1024 /C FOO.BAT".
>
Ok, this method works if the `Program Filename' in the .pif file
is COMMAND.COM and the `Optional Parameters' is /e:1024 /c foo.bat.
If the Program Filename is supplied as ``command.com /e:1024 /c foo.bat'',
a window pops up saying that it cannont find the file COMMAND.COM /E:1024...
Some batch files I run don't accept parameters and I can define a working
.pif for these using /e:1024 /c as an Optional Parameter in the PIF Editor.
However, many of my batch files accept parameters and defining the .pif
in this manner doesn't allow Windows to prompt me for the parameter
before running the batch file. It's a big problem.

What is needed is a flag in either win.ini or system.ini specifying
default parameters for command.com whenever Windows needs to spawn
command.com (ie: to run a batch file from a .pif). This seems so
simple that I can't believe Windows doesn't allow for this functionality.
Maybe there's another solution?

Sal.
-------
Salvatore Saieva                            Internet: slvqc@cunyvm.cuny.edu
Queens College, Academic Computer Center      BITNET: slvqc@cunyvm.bitnet
65-30 Kissena Blvd, Flushing, N.Y. 11367     DeskNet: (718) 520-7662

davidr@hplsla.HP.COM (David M. Reed) (07/10/90)

Ever since HP started selling MS-DOS it has included a "Personal Application
Manager" program (PAM) for starting applications.  This is great for non-DOS
users who do not want to learn/remember a few simple commands to issue from
the DOS prompt.  One problem I have had with PAM for years is that no matter
how much environment space you reserve on startup (SHELL=COMMAND /E:xxxx), any
unused environment appears to be "truncated" (like at the next paragraph
boundary after what is used).  This has lent itself to the annoying/frustrating
"Insufficient environment" messages from BATch files.

I find that MSWindow3 is exhibiting the same kind of "wrong" behaviour.  Thus
I must do what I have done for years with PAM users.  In my AUTOEXEC.BAT file
I set one or more large variables, e.g.

     SET X=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Then, one of the first statements in a BATch file is "SET X=".  This will
clear the "place-holder" variable, freeing up all memory it was reserving.
There is no error if X was not previously SET, and it take virtually no
additional startup time.  Since DOS command lines are limited to 128 
characters, if I need a lot of memory reserved I SET several such variables.
This seems to work just fine with MSWindows3 and PAM, with only a little
extra effort on my part (that I should not have to do, if these programs
would not grab "currently unused" environment space that I had reserved
in CONFIG.SYS).

patrickd@chinet.chi.il.us (Patrick Deupree) (07/10/90)

In article <90183.141937SLVQC@CUNYVM.BITNET> SLVQC@CUNYVM (Salvatore Saieva) writes:
>I'm running Windows 3.0 in 386 enhanced mode on top of DOS 4.0.
>Is there a way to tell Windows to start a Non-Windows application
>with a larger environment?

This is what you do.  Create a .PIF file for your program.  As the program
name, use command.com.  In your parameter listing put:

	/e:1024 /c <program name>

This will start a new command.com with your larger environment (and the /c
option says that command.com should be removed when the program is finished
executing).
-- 
"Organized fandom is composed of a bunch of nitpickers with a thing for
 trivial pursuit."  -Harlan Ellison

Patrick Deupree ->	patrickd@chinet.chi.il.us

davidr@hplsla.HP.COM (David M. Reed) (07/13/90)

NOTE that in doing something like this (which does work):

#  . . .   Create a .PIF file for your program.  As the program
#  name, use command.com.  In your parameter listing put:
#
#        /e:1024 /c <program name>

you do suffer from slightly less space for the application because command
gets loaded and then executes the program.

hughes@maelstrom.Berkeley.EDU (Eric Hughes) (01/10/91)

How to increase environment space in DOS?

1.  Use the /E switch in the SHELL= statement in config.sys.
2.  Run COMMAND.COM from a .PIF file, and specify a /E switch as part
   of the command line.  (I have not tested this, can someone verify?)
3.  Use 4DOS, a replacement for COMMAND.COM.  4DOS has a /E switch.

Eric Hughes
hughes@ocf.berkeley.edu

fozzard@alumni.colorado.edu (Richard Fozzard) (01/15/91)

In article <HUGHES.91Jan9160643@maelstrom.Berkeley.EDU> hughes@maelstrom.Berkeley.EDU (Eric Hughes) writes:
>How to increase environment space in DOS?
>
>1.  Use the /E switch in the SHELL= statement in config.sys.
>2.  Run COMMAND.COM from a .PIF file, and specify a /E switch as part
>   of the command line.  (I have not tested this, can someone verify?)
>3.  Use 4DOS, a replacement for COMMAND.COM.  4DOS has a /E switch.

If the problem is enough environment space in any of the DOS shells win3
gives you (eg: running an ordinary batch file within a window, the
factory-supplied "DOS shell"), the SHELL= statement doesnt help. win3
runs COMMAND.COM. Though you could mess with .PIF files, they are UGLY.

For the factory "DOS shell", select it, choose Properties from the File
menu and add a "/e:1000" after the "COMMAND.COM". Try different numbers
to determine the environment size you need. For a .BAT file that you may
have "copied" from the File mgr to the Pgm mgr, you can edit its
Properties as well. Just add "command.com /e:1000 /c " in front of the
pathname win3 put there automatically.

Though win3 is a big improvement over DOS, sadly it doesn't really insulate
you from DOS's frustrating limitations and cryptic commands. (My pet peeve:
Why, of why couldn't they have done something to give us REAL filenames,
like in Unix or the Mac?)
-- 
========================================================================
Richard Fozzard					"Serendipity empowers"
Univ of Colorado/CIRES/NOAA	R/E/FS  325 Broadway, Boulder, CO 80303
fozzard@boulder.colorado.edu                   (303)497-6011 or 444-3168