Assistance with creating Windows batch files to launch programs and restart the original after the second one exits.
Assistance with creating Windows batch files to launch programs and restart the original after the second one exits.
Hi guys, I need some assistance. I'm not very experienced with programmers or batch creators, so I thought I'd ask for advice here...
I want to set up something like this (assuming I'm already in Program A where I can run a custom script to call a .bat file from). When the .bat system starts:
1- close Program A
2 - start Program B
3 - when Program B closes, start Program A again
I'm not sure if this is feasible, but any suggestions would be great!
Windows 10 Pro
Create two batfiles. Swap program_a.exe and program_b.exe as needed.
batfile1.bat
Code:
@echo running batfile1
cd c:\program_a
./program_a.exe
pause
call batfile2.bat
batfile2.bat
Code:
@echo running batfile2
cd c:\program_b
./program_b.exe
pause
call batfile1.bat
It appears to be very straightforward. What methods have you attempted and which ones fail? Also, note that you might encounter an infinite loop.
Seconding
@SkyNetRising
Program A refers to a specific initiative, while Program B outlines another approach. Program B is closed due to certain constraints, and the reasons behind its closure are important. A PowerShell script could provide clearer insights into these details.
Program A serves as a frontend for the virtual pinball cabinet named pinuppopper. Program B acts as a frontend for retro gaming called BigBox. In short, the cabinet supports both pinball and retro games, though each frontend excels at its own platform but struggles with the other. I received advice from the pinball team to develop a batch file that launches pinuppopper and then starts BigBox. The batch file is functional, using naming properties so it appears in the operator menu within the frontend, enabling smooth transitions between A and B. This process moves me from B back to A without creating an endless loop, as the batch runs manually. Please let me know if you need further assistance!
Create two batfiles. Swap program_a.exe and program_b.exe as needed.
batfile1.bat
Code:
@echo running program_a.exe
cd c:\program_a
pause
call batfile2.bat
batfile2.bat
Code:
@echo running program_b.exe
cd c:\program_b
pause
call batfile1.bat
Avoid calling the other batfile recursively, or you'll be getting trouble.