Board index » delphi » Batch (.BAT) file waits until Delphi EXE finishes?

Batch (.BAT) file waits until Delphi EXE finishes?

Hello, fellow Delphiles...

I want to write a batch file that looks like this:

  @ECHO OFF
  REM Run Delphi program XYZ.EXE
  XYZ              
  IF ERRORLEVEL 2 GOTO LABEL2
  GOTO QUIT
  :LABEL2
  ECHO That was error level 2!
  :QUIT

When I run this under Win95, XYZ.EXE starts up and then the batch
file continues, due to multi-tasking.  I want some way to have XYZ.EXE
stop any further processing, so the batch file can find out the result
of XYZ's Halt() procedure.

In order to get XYZ to stop further processing, I tried experimenting
with this (which was suggested in the Delphi Help):

  procedure TForm1.FormCreate(Sender: TObject);
  begin
    Application.OnIdle := AppIdle;
  end;

  procedure TForm1.AppIdle(Sender: TObject; var Done: Boolean);
  begin
    Done := False;
  end;

Alas, this did NOT stop the batch file from plowing onwards.

All this makes me wonder why Delphi has a Halt() procedure...

____________________________________________________________________
Timothy Campbell (Pinnacle Software) 514-345-9578; BBS: 514-345-8654
pinn...@cam.org; Shareware and Freeware: http://www.cam.org/~pinnacl

 

Re:Batch (.BAT) file waits until Delphi EXE finishes?


Quote

> When I run this under Win95, XYZ.EXE starts up and then the batch
> file continues, due to multi-tasking.  I want some way to have XYZ.EXE
> stop any further processing, so the batch file can find out the result
> of XYZ's Halt() procedure.

I don't know exactly.
try instead of calling XYZ.EXE directly the follwing line in your batch
START /W XYZ.EXE

This should wait until XYZ finishes.

MEW

Re:Batch (.BAT) file waits until Delphi EXE finishes?


Quote
Timothy Campbell wrote:

> Hello, fellow Delphiles...

> I want to write a batch file that looks like this:

>   @ECHO OFF
>   REM Run Delphi program XYZ.EXE
>   XYZ
>   IF ERRORLEVEL 2 GOTO LABEL2
>   GOTO QUIT
>   :LABEL2
>   ECHO That was error level 2!
>   :QUIT

> When I run this under Win95, XYZ.EXE starts up and then the batch
> file continues, due to multi-tasking.  I want some way to have XYZ.EXE
> stop any further processing, so the batch file can find out the result
> of XYZ's Halt() procedure.

> In order to get XYZ to stop further processing, I tried experimenting
> with this (which was suggested in the Delphi Help):

>   procedure TForm1.FormCreate(Sender: TObject);
>   begin
>     Application.OnIdle := AppIdle;
>   end;

>   procedure TForm1.AppIdle(Sender: TObject; var Done: Boolean);
>   begin
>     Done := False;
>   end;

> Alas, this did NOT stop the batch file from plowing onwards.

> All this makes me wonder why Delphi has a Halt() procedure...

> ____________________________________________________________________
> Timothy Campbell (Pinnacle Software) 514-345-9578; BBS: 514-345-8654
> pinn...@cam.org; Shareware and Freeware: http://www.cam.org/~pinnacl

Hi,

In you batch file, call XYZ.EXE like this:

start /Wait XYZ.EXE

At a Win95 command prompt, enter start/? for some more useful options.

Other Threads