Question Windows Batch File Creation Help - Launch program from within another and relaunch original upon exit of second

wolpoffm

Distinguished
Dec 5, 2011
3
0
18,510
0
Hi guys, I have a request for some help. I am not much of programmer or batch creator so I thought I would ask here...

I am looking to do the following ( assuming I am already within Program A from where I can launch a custom script to call a .bat file from)

Upon launch of .bat system would:
1- close Program A
2 - Launch Program B
3 - Upon closure of Program B - Launch Program A again


Not sure if this is possible or not, but any help is appreciated!

Windows 10 Pro
 

wolpoffm

Distinguished
Dec 5, 2011
3
0
18,510
0
Seconding @SkyNetRising

Add some details:

What is Program A?

What is Program B?

What closes Program B? How/ why is Program B closed?

A Powershell script may be much more suitable.

Details matter.
Program A is a frontend for a virtual pinball cabinet called pinuppopper. Program B is a frontend for retro gaming called BigBox. Long story short is the cabinet can play both pinball and retro games but the two frontends handle their respective platforms very well but they don't handle the other very well. I have some advice from the people on the pinball side to create a batch file that closes pinuppopper and starts BigBox. I have that batch file created and working. This works through that frontend by the naming properties of the batch file and the frontend recognizing it and allowing me to select that batch file from the operator menu within the frontend. This gets me from A to B, I need help getting from B back to A. It shouldn't be an infinite loop because it is a manually launched batch, when I exit program A normally, the batch wouldn't launch.

Here is what I have that works:

SendPUPEvent.exe 11
timeout 3
cd c:\bigbox
start "" bigbox.exe

Thanks for any input you can provide!
 
Here is what I have that works:
Make 2 batfiles.
Replace program_a.exe and program_b.exe with your actual programs to be called.

batfile1.bat
Code:
@echo batfile1 running
c:\program_a\program_a.exe
pause
call batfile2.bat
batfile2.bat
Code:
@echo batfile2 running
c:\program_b\program_b.exe
pause
call batfile1.bat
After testing, if it works properly, remove lines with pause.
 
Last edited:
Reactions: Mandark
Make 2 batfiles.
Replace program_a.exe and program_b.exe with your actual programs to be called.

batfile1.bat
Code:
@echo batfile1 running
c:\program_a\program_a.exe
pause
call batfile2.bat
batfile2.bat
Code:
@echo batfile2 running
c:\program_b\program_b.exe
pause
call batfile1.bat
After testing, if it works properly, remove lines with pause.
Don't "call" recursively the other batfile, or you're asking for troubles.
 

ASK THE COMMUNITY

TRENDING THREADS