Dempsey got it... Although he made a woopsy with the
find parameters:
code:
@ECHO OFF
tasklist | find /i "synergys.exe" 1>NUL 2>&1
IF %ERRORLEVEL% EQU 0 (
taskkill /f /t /im synergys.exe
"c:\program files\ultramon\ultramon.exe" /e
)
IF %ERRORLEVEL% EQU 1 (
"c:\program files\synergy\synergys.exe" -a pieceofcrap:24800 -d FATAL
"c:\program files\ultramon\ultramon.exe" /d
)
PS: other changes:
- 1>NUL 2>&1 will also surpress error messages on screen.
- Reason for 2 seperate IFs instead of the IF tHEN ELSE like before is so that the second one is not executed when an error (=errorlevel 2) occurs in the FIND command.
- Added parameter /T to taskkill command which will kill the process tree instead of only the process.
- No reason to first change the current directory to the respective program folders