@ECHO OFF
echo.
echo STARTING MANCATS with SCANMATIK2 interface
echo.

reg import syscall_sm.reg 2> nul

tasklist /NH 2>&1 | findstr "TABMAN.exe" >nul
IF %ERRORLEVEL% EQU 0 goto end

fc /b "%ProgramFiles%\Teradyne\T-MVCI J2534\TMVCI32.dll_sm" "%ProgramFiles%\Teradyne\T-MVCI J2534\TMVCI32.dll" > nul
IF %ERRORLEVEL% EQU 0 goto same

tasklist /NH 2>&1 | findstr "TMVCIDevMgrD.exe" >nul
IF %ERRORLEVEL% EQU 0 goto restart

copy /Y "%ProgramFiles%\Teradyne\T-MVCI J2534\TMVCI32.dll_sm" "%ProgramFiles%\Teradyne\T-MVCI J2534\TMVCI32.dll" >nul

:same
start TABMAN.exe
start ManImmo.exe
start MANkey.exe
nircmd.exe waitprocess TABMAN.exe cmdwait 1500
taskkill /T /F /IM TABMAN.exe 2> nul
taskkill /T /F /IM testman.exe 2> nul
taskkill /T /F /IM FlukeView.exe 2> nul
taskkill /T /F /IM MANkey.exe 2> nul
taskkill /T /F /IM ManImmo.exe 2> nul
taskkill /T /F /IM Communicationswitcher.exe 2> nul
taskkill /T /F /IM MANCats_Systray.exe 2> nul

goto end

:restart
nircmd infobox "TO SWITCH INTERFACE COMPUTER WILL BE RESTARTED NOW~n~nABY PRZELACZYC INTERFEJS KOMPUTER ZOSTANIE TERAZ PONOWNIE URUCHOMIONY~n~nUM DIE SCHNITTSTELLE ZU WECHSELN, WIRD DER COMPUTER JETZT NEU GESTARTET" "Interface switch"
nircmd exitwin reboot

:end
