Solved

environment space .bat

Posted on 2001-06-26
14
296 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
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
 
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
Are your end users making ugly email signatures?

Have you left it up to your end users to create their own email signatures? Are they forgetting to add the company logo or using garish font colors? Take control and ensure all users have the same email signature.

 

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

Free book by J.Peter Bruzzese, Microsoft MVP

Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

Question has a verified solution.

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

Suggested Solutions

Several part series to implement Internet Explorer 11 Enterprise Mode
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

911 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

18 Experts available now in Live!

Get 1:1 Help Now