Link to home
Start Free TrialLog in
Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America

asked on

Setting command.com initial environment from Delphi GUI

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!

Avatar of Madshi
Madshi

Try this one:

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

Does that help?

Regards, Madshi.
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
Avatar of Tom Knowlton

ASKER

Madshi / edey:

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

Tom
Madshi:

Resubmit your comment as an answer, please.  Your comment was exactly what I needed.  Geez...I was *that* close to solving this myself.
ASKER CERTIFIED SOLUTION
Avatar of Madshi
Madshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No problem.  :)
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.

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