Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Setting command.com initial environment from Delphi GUI

Posted on 1999-09-16
7
Medium Priority
?
183 Views
Last Modified: 2010-05-18
I have a Delphi 3 program which creates a batch file based on selections made by the user.  I then use WinExec( ) to run the batch file.

The problem is, when WinExec opens the DOS Shell (in order to run the batch file) the DOS Shell does not have the correct initial environment size (4096 KB) needed for the batch file.

How do I programmatically set the initial environment so I don't get "Out of environment space" when I run the batch file?

Please...only submit comments for now.  If a comment works, I'll have you resubmit the comment as an answer.

Thanks!

0
Comment
Question by:Tom Knowlton
[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
7 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 2052302
Try this one:

  WinExec('C:\Command.Com /E:4096 /C C:\YourPath\YourBat.bat');

Does that help?

Regards, Madshi.
0
 
LVL 6

Expert Comment

by:edey
ID: 2052304
I should think that you would be able to do this via the commandline parameters:

COMMAND [[drive:]path] [device] [/E:nnnnn] [/L:nnnn] [/U:nnn] [/P] [/MSG]
                       [/LOW] [/Y [/[C|K] command]]
  [drive:]path    Specifies the directory containing COMMAND.COM.
  device          Specifies the device to use for command input and output.
  /E:nnnnn        Sets the initial environment size to nnnnn bytes.
                  (nnnnn should be between 256 and 32,768).
  /L:nnnn         Specifies internal buffers length (requires /P as well).
                  (nnnn should be between 128 and 1,024).
  /U:nnn          Specifies the input buffer length (requires /P as well).
                  (nnn should be between 128 and 255).
  /P              Makes the new Command Interpreter permanent (can't exit).
  /MSG            Stores all error messages in memory (requires /P as well).
  /LOW            Forces COMMAND to keep its resident data in low memory.
  /Y              Steps through the batch program specified by /C or /K.
  /C command      Executes the specified command and returns.
  /K command      Executes the specified command and continues running.


GL
Mike
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 2052383
Madshi / edey:

I will try your suggestions.  Madshi's response looks like the one I want.

Tom
0
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!

 
LVL 5

Author Comment

by:Tom Knowlton
ID: 2052434
Madshi:

Resubmit your comment as an answer, please.  Your comment was exactly what I needed.  Geez...I was *that* close to solving this myself.
0
 
LVL 20

Accepted Solution

by:
Madshi earned 800 total points
ID: 2052455
Well, nice, that it works - and thanx for the points...   :-)

Regards, Madshi.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 2052677
No problem.  :)
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6866436
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

671 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