Stop program when another program ends.

January 14, 2012 at 08:37:39
Specs: Windows 64 Win7 Build 7601., I5 2500k, 8gb
I'm not very experienced. I want to start EventGhost (EG) which will start MediaMonkey (MM) and when MM is ended, the batch job will end EG. Here is my batch job which starts EG (and MM) but does not stop EG when MM stops.
cd C:\Program Files (x86)\
Start EventGhost\EventGhost.exe -hide -configdir N:\Program Info\EventGhost for MediaMonkey
cd C:\
start "MM" /wait "C:\Program Files (x86)\MediaMonkey\Mediamonkey.exe"
stop "" "C:\Program Files (x86)\EventGhost\EventGhost.exe"
cls
exit

I tried this start /wait which I got from the EG forum but it doesn't work either. I tried many different iterations of this (with ", etc. but nothing works). I don't understand what the && is for and can't find info on this anywhere.
cd c:\Program Files (x86)\
start /wait MediaMonkey\Mediamonkey.exe && EventGhost\EventGhost.exe -e ProgramFinished

I think I'm close but don't know what else to try.
Thanks.


See More: Stop program when another program ends.

Report •

#1
January 15, 2012 at 18:58:26
I think the && translates as "and if successful". So that whole line translates as:

start MediaMonkey.exe and wait for it to terminate. If that is successful, start EventGhost.

see: http://www.robvanderwoude.com/conde...

I'm not sure that the && will work in conjunction with /wait though. You might put them on separate lines like this:

@echo off
cd "c:\program files (x86)"
start /wait MediaMonkey\Mediamonkey.exe
start EventGhost\EventGhost.exe -e

If that doesn't work, I can help you come up with an IF statement that will check for MediaMonkey termination prior to starting EventGhost.


Report •

#2
January 16, 2012 at 07:32:00
This works.
@echo off
cd C:\Program Files (x86)\
Start EventGhost\EventGhost.exe -hide -configdir N:\Program Info\EventGhost for MediaMonkey
cd C:\
start "MM" /wait "C:\Program Files (x86)\MediaMonkey\Mediamonkey.exe"
taskkill /im EventGhost.exe /t /f
cls
exit

Report •
Related Solutions


Ask Question