@echo off

:checkFirefox
tasklist /fi "ImageName eq firefox.exe" /fo csv 2>NUL | find /I "firefox.exe">NUL
if "%ERRORLEVEL%"=="0" goto firefoxOpen
goto runSync

:firefoxOpen
cls
echo.
echo Firefox is running!
CHOICE /c cq /n /m "Press [C] to kill Firefox and continue or [Q] to quit"
IF %errorlevel%==1 goto killAndContinue
IF %errorlevel%==2 goto quit

:killAndContinue
taskkill /f /im firefox.exe
goto runSync

:runSync
cls
echo.
echo Running FFS sync!
"C:\Program Files\FreeFileSync\FreeFileSync.exe" "X:\PATH\TO\YOUR\FFS_BATCH\CONFIG"
goto quit

:quit
exit