Board index » delphi » Using CreateProcess to run dos batch file

Using CreateProcess to run dos batch file

Hi

I'm writing a program with Delphi v3.0 under Win95. I am using the
CreateProcess function to execute a dos batch file to do a BCP to a SQL
server. This all works fine, the problem is that the dos window does not
want to close automaticaly after the batch file is finished. Can any one
help please.

Thanks
Frans

 

Re:Using CreateProcess to run dos batch file


Its Not very elegant but you can:
   1)  Create a shortcut for  the batch file.
   2)  Set the properties of the shortcut to "close on exit"

Just a thought.

In article <6l600e$nh...@hermes.is.co.za>,
  "Frans Smit" <fs...@atac.co.za> wrote:

Quote

> Hi

> I'm writing a program with Delphi v3.0 under Win95. I am using the
> CreateProcess function to execute a dos batch file to do a BCP to a SQL
> server. This all works fine, the problem is that the dos window does not
> want to close automaticaly after the batch file is finished. Can any one
> help please.

> Thanks
> Frans

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

Re:Using CreateProcess to run dos batch file


Frans Smit <fs...@atac.co.za> wrote in article
<6l600e$nh...@hermes.is.co.za>...

Quote
> I'm writing a program with Delphi v3.0 under Win95. I am using the
> CreateProcess function to execute a dos batch file to do a BCP to a SQL
> server. This all works fine, the problem is that the dos window does not
> want to close automaticaly after the batch file is finished. Can any one
> help please.

Any particular reason why you are using CreateProcess?
ShellExecute (API command) works perfectly. Well at least it does under NT.
I can't be sure how it works under 95. But then who could be? :)

- Graeme Vincent

Re:Using CreateProcess to run dos batch file


Create a shortcut for the DOS Batch file. In it's properties you can set
"close on exit".

BTW, after you ran the batch file for the first time, there should be a
shortcut created already automatically, normally in the same directory as
the .bat file.

Reinhard

Quote
Frans Smit wrote:
> Hi

> I'm writing a program with Delphi v3.0 under Win95. I am using the
> CreateProcess function to execute a dos batch file to do a BCP to a SQL
> server. This all works fine, the problem is that the dos window does not
> want to close automaticaly after the batch file is finished. Can any one
> help please.

> Thanks
> Frans

Other Threads