[comp.windows.ms] Batch files and environment space

droufa@matt.ksu.ksu.edu (Donald J Roufa) (12/24/90)

	Help!!$%  When I run a batch file to envoke a non-Windows
application which must set an environment variable, I find that
Windows ver. 3 spawns a shell with only 160 bytes of environment
space, despite the fact that my config.sys file sets the original
environment space to 512 bytes.  As a consequence, the non-Windows
application is unable to run for lack of environment space.  The only
solution I have found so far is to reset the Path and other
non-related environment variables within the batch file being spawned,
so that the new application will find some room within the 160 bytes.
Isn't there some way to tell Windows to run batch files with more
environment space available to them?
--
    Don Roufa        E-Mail: DROUFA@MATT.KSU.KSU.EDU    //  | /  /---  |  |
Division of Biology          DROUFA@KSUVM.KSU.EDU      //   |/   |__   |  |
Kansas State Univ.   Tel: (913) 532-6641              //    |\      |  |  |
Manhattan, KS 66506  Fax: (913) 532-6653             //     | \  \__/  \__/

cgordon@vpnet.chi.il.us (Crash Gordon) (12/27/90)

>Author: [Donald J Roufa]
>Windows ver. 3 spawns a shell with only 160 bytes of environment
>Isn't there some way to tell Windows to run batch files with more
>environment space available to them?

Not that I'm aware of.  (I'm no expert!)  But what I do is set an
environment variable in AUTOEXEC.BAT, that is just filler.  Then I can clear
this one to free up environment space in Windows.

SET DUMMY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

You get the picture...

-----------------------------------------------------
Gordon S. Hlavenka            cgordon@vpnet.chi.il.us
Disclaimer:                Yeah, I said it.  So what?

steveha@microsoft.UUCP (Steve Hastings) (12/28/90)

>>Author: [Donald J Roufa]
>>Windows ver. 3 spawns a shell with only 160 bytes of environment
>>Isn't there some way to tell Windows to run batch files with more
>>environment space available to them?

On a case-by-case basis, there is.  In Program Manager, choose File
Properties.  Edit the Command Line to say "COMMAND.COM /e:xxxx /c foo.bat"
where xxxx is how many bytes of environment space you want.  I use 1024.

From then on, when you double-click that icon, the batch file will run with
sufficient environment space.

To ensure that your DOS Prompt has enough environment space, either edit
its Command Line to say "COMMAND.COM /e:xxxx" or make a PIF file for it
that includes that Command Line.  I use the PIF file, since that way I can
assign a hot key to zap into that DOS shell.

For more information on command-line switches to COMMAND.COM, read your DOS
manual.

This material belongs in some kind of Frequently Asked Questions posting.
-- 
Steve "I don't speak for Microsoft" Hastings    ===^=== :::::
uunet!microsoft!steveha  steveha@microsoft.uucp    ` \\==|

rm3@stc06.ornl.gov (MCBROOM R C) (12/29/90)

In article <60082@microsoft.UUCP> steveha@microsoft.UUCP (Steve Hastings) writes:
>>>Author: [Donald J Roufa]
>>>Windows ver. 3 spawns a shell with only 160 bytes of environment
>>>Isn't there some way to tell Windows to run batch files with more
>>>environment space available to them?
>
>On a case-by-case basis, there is.  In Program Manager, choose File
>Properties.  Edit the Command Line to say "COMMAND.COM /e:xxxx /c foo.bat"
>where xxxx is how many bytes of environment space you want.  I use 1024.
>
>From then on, when you double-click that icon, the batch file will run with
>sufficient environment space.
>
>To ensure that your DOS Prompt has enough environment space, either edit
>its Command Line to say "COMMAND.COM /e:xxxx" or make a PIF file for it
>that includes that Command Line.  I use the PIF file, since that way I can
>assign a hot key to zap into that DOS shell.
 
Putting SHELL = COMMAND.COM /E:XXXX/P in your config.sys provides a general 
solution also for the DOS versions that support SHELL.

reedj@hplsla.HP.COM (Reed Jacobsen) (01/03/91)

I don't know if this is the best way to work around the problem, but
it works.

In your AUTOEXEC.BAT create an environment variable like
set RESERVE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(you can set more than one depending on how much space you need).

Then in the shell bat file, execute set RESERVE=, which releases the
space for use in the lower level of shell

I agree it would be better if Windows allowed direct control, but . . .

-------------------------------------------------------------------------
Reed Jacobson
reedj@hplsla.hp.com