Solved

environment space .bat

Posted on 2001-06-26
14
295 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
  • 8
  • 5
14 Comments
 
LVL 3

Accepted Solution

by:
czpczp earned 30 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 3

Expert Comment

by:czpczp
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
samlain,
you have 7 open questions, what do you plan to do with those.

Thank you
Glenn
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:samliam
Comment Utility
> 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Are your corporate email signatures appalling?

Is it scary how unprofessional your email signatures look? Do users create their own terrible designs and give themselves stupid job titles? You can make this a lot easier for yourself by choosing an email signature management solution from Exclaimer today.

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now