Something like this should do it:
code:
@echo off
tasklist | find /i \"" & synergys.exe & "\" >nul
if %errorlevel% EQU 0 (
taskkill /f /im synergys.exe
cd "c:\program files\ultramon"
ultramon.exe /e
) ELSE (
cd "c:\program files\synergy"
synergys.exe -a pieceofcrap:24800 -d FATAL
cd "c:\program files\ultramon"
ultramon.exe /d
)