?
Solved

environment space .bat

Posted on 2001-06-26
14
Medium Priority
?
310 Views
Last Modified: 2013-12-28
How do I change the environment space in a batch file?

I have a batch file which is supposed to work on any Windows system. However, inside the .bat file, there is a lengthy 'set' statement. This exausts the environment space.

I do not want to change config on any system that I deploy this onto. Therefore, I need to do it in the .bat file.

I was told to try "set path=" in the beginning. However, I need to use a command that is from a software that is installed on different folders with different computers. So "set path=" does not work.

How can I do this?
Thanks.
0
Comment
Question by:samliam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
14 Comments
 
LVL 3

Accepted Solution

by:
czpczp earned 120 total points
ID: 6229231
Hi Sam.  Yes, you can change it on the fly.  Increase the environment (in this example 4096) by doing the following *prior* to the path statement.


Try this:

c:\command.com/e:4096/c set path=whatever....
0
 

Author Comment

by:samliam
ID: 6229309
This is my .bat file:

set ARGUMENTS=arg1 arg2 arg3 arg4 ..... arg99
perl ...\some.pl arg1 arg2

I tried adding "command.com /e:2000" before "set ARGUMENTS..", I got :
too many parameters
too many parameters
  ....
0
 
LVL 3

Expert Comment

by:czpczp
ID: 6229389
Put that line separatly than in the beginning of the batch by itself than continue with the set command.

command.com /e:2000
set ARGUMENTS=arg1 arg2 arg3 arg4 ..... arg99
perl ...\some.pl arg1 arg2
0
Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

 
LVL 3

Expert Comment

by:czpczp
ID: 6229482
Hi Sam.  Few more things to consider:

Windows98 uses the Command.com from the Windows directory, by default.  Rather than using c:\command.com (from the root), use C:\Windows\Command.com /e:2000.

The following are the same (if "c:\windows" is your Windows directory):

C:\Windows\Command.com /e:2000

?or

%comspec% /e:2000


Compsec is the environment variable that puts the used command interpreter into memory.  It's better to use 'cause it'll grab the command interpreter that's actually being used.
0
 

Author Comment

by:samliam
ID: 6229575
actually, the first thing I tried was

command.com /e:2000
set ARGUMENTS=arg1 arg2 arg3 arg4 ..... arg99
...

It didn't work.

I was given a command interpreter prompt and it was waiting for input. It didn't execute the commands following.
0
 
LVL 3

Expert Comment

by:czpczp
ID: 6229630
Using the /k switch seems to be the best route.  It'll increase you're environment on the same line and carry out setting your environment variable.  It then carries on with the rest of the batch w/o asking for further instruction.

So, try:

command.com /e:2000 /k set ARGUMENTS=arg1 arg2 arg3 arg4 ..... arg99
0
 
LVL 15

Expert Comment

by:hewittg
ID: 6229910
samlain,
you have 7 open questions, what do you plan to do with those.

Thank you
Glenn
0
 

Author Comment

by:samliam
ID: 6231076
> command.com /e:2000 /k set ARGUMENTS=arg1 arg2 arg3 arg4 ..... arg99

it executes the 'set ARGUMENTS' line alright, but it exit without executing the next line...
0
 
LVL 3

Expert Comment

by:czpczp
ID: 6231356
Hi Sam.  I see what's going on.  Please go back to my original suggestion of using the /c switch BUT don't carry out the SET command on the same line but rather on the following.  I just tested exactly that and worked perfectly.


Do this:

C:\Windows\Command.com /e:2000 /c
set ARGUMENTS=arg1 arg2 arg3 arg4 ..... arg99
..next command
..next command


This should solve it for you.

0
 

Author Comment

by:samliam
ID: 6231533
out of environment space...

well, I've managed to do it from my calling program. Thanks for your time. However, if you figure out how to do it. I'll still be interested to know about it.
0
 
LVL 3

Expert Comment

by:czpczp
ID: 6231557
Increase the allocated space from /e:2000 to something like /e:4096 or a higher multiple of 512k.  Once the batch session ends, it'll release the shell environment that you specify out of memory.

If you continue to get the message (hard to believe with 4096) then gradually increase it.

If the problem persists, let me know and we'll go a different route.
0
 
LVL 3

Expert Comment

by:czpczp
ID: 6231664
If you're running this from an icon, then you need to change the "Initial Environment" within Properties.

Right click icon, choose Properties then Memory Tab -- in Initial Environment choose 4096.
0
 

Author Comment

by:samliam
ID: 6232379
well, I use /e:1000 in my program and it's enough. So it's not the size that's causing problem.
0
 
LVL 3

Expert Comment

by:czpczp
ID: 6232771
Hi Sam.  Please keep in mind that Win9x has a character limit to how long the path statement may be.  It's been a while since I encountered this -- the limit is something like 127 or 256 *allowable* characters (something like that).
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question