Solved

environment space .bat

Posted on 2001-06-26
14
308 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 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
WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Determining the an SCCM package name from the Package ID
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

636 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