Run batch file on exit of program?

G

Greg Strong

Is there anyway to run a batch file when you exit a program?

Regards,


Greg Strong
 
N

Nelson

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 . . .
 
G

Greg Strong

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
 
N

Nelson

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
 
D

David Candy

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 /?.
 
A

Alex Nichol

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'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top