Solved

environment space .bat

Posted on 2001-06-26
14
300 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
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…
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…

756 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