Re: Calling Batch Files from Main Form

Posted by webmaster Guido on May 05, 2000

In Reply to: Calling Batch Files from Main Form posted by Rick Ashford on May 05, 2000

: I am trying to call a series of batch files from my main form. The hard part is that I need to specify that they be executed with 4Dos instead of MS-Dos, so I can't just use the ShellExecute function. I've added the batch files to my project, and I've modified the command property to tell it to run through 4Dos, but I need to know how to call it in my form. Do I have to modify the "uses" to include the files? How do I get it to run without using ShellExecute?

Don't add the batch files to the project, don't put them in the "uses", because then Delphi tries to compile them (only can compile .pas files). Probably you have to call 4Dos "with" a batch file, like in the old DOS days you called the command shell "" plus a batch file. I don't know how to do this..., so look for some DOS-guru?

If it doesn't work with ShellExecute, it won't work any other way. Try giving the 4Dos program (what's it called?) as the program to execute to ShellExecute and give the batch file as a parameter? (see the section "Code Snips" for some examples for executing external programs).

Find related articles

Search for:  shellexecute  batch file  BAT file

Delphi Forum :: Tutorials :: Source code :: Tips