Run batch file on exit of program?

  • Thread starter Thread starter Greg Strong
  • Start date Start date
Sure . . . start the program from a batch file and when
you close it the batch file will continue to execute . . .
put in whatever commands you want . . .
 
Sure . . . start the program from a batch file and when
you close it the batch file will continue to execute . . .
put in whatever commands you want . . .

I tried it. Looks like bat file continued to run because command window
closed before I exited the GUI program. So no go. Any other ideals?
TIA!

Regards,


Greg Strong
 
Greg -
You say "Looks like the bat file continued to run because
(the) command window closed before I exited the GUI
program". If the bat file continued to run it WOULD NOT
close after you exited the GUI program. Try this test and
prove to yourself that it works. Copy this bat file to
xx.bat and run it yourself:
@echo off
"C:\Program Files\Windows NT\Accessories\Wordpad.exe"
echo.
echo.
echo Hello, I'm still running . . .
echo.
echo.
pause

After you activate this it will start Wordpad. Then close
Wordpad and the command window is there . . .
Thx
N
 
A windows program will run and the batch will continue a soon as he program has started. A Dos program will run and the batch will wait for it to finish. There are various ways of changing this. The easiest is Start, Type start /?.
 
Greg said:
I tried it. Looks like bat file continued to run because command window
closed before I exited the GUI program. So no go. Any other ideals?
TIA!

In the bat file, invoke program.exe with the line

Start /w program.exe <any parameters it needs>

The /w switch says 'wait for completion before proceeding'
 
Back
Top