ProgramA closes and ProgramB closes automatically
Posted: 11 Sep 2019 13:22
Hello,
I would like that Batch automatically close ProgramB (Syncprogram) before I close ProgramA (Minecraft)
Here is my code:
The problem is it does not work.
My idea was to place a loop with :Main. If Minecraft still running the Sync program does not close because it jumps up and repeats until Minecraft closes. When it closes it will be redirected to EAD and the sync close.
Can anyone help me with that?
I would like that Batch automatically close ProgramB (Syncprogram) before I close ProgramA (Minecraft)
Here is my code:
Code: Select all
@echo off
start "" "C:\Users\Viktor\Documents\FreeFileSync Auftraege\RealTimeSync Auftraege\RealTime_(.minecraft-GoogleDrive)_[Mirror].ffs_real"
start "" "C:\Users\Viktor\Documents\FreeFileSync Auftraege\RealTimeSync Auftraege\RealTime_(.minecraft-Backupfolder)_[Mirror].ffs_real"
timeout 3 >nul
start "" "C:\Program Files (x86)\Minecraft\MinecraftLauncher.exe"
:MAIN
tasklist /fi "imagename eq MinecraftLauncher.exe"
if not '%ERRORLEVEL%'=='0' goto DEAD
goto MAIN
:DEAD
taskkill /f /im RealTimeSync_x64.exe
exit
My idea was to place a loop with :Main. If Minecraft still running the Sync program does not close because it jumps up and repeats until Minecraft closes. When it closes it will be redirected to EAD and the sync close.
Can anyone help me with that?