@echo off
if "%1" == "" goto Error_Break
if "%2" == "" goto Error_Break
@echo setting the POSTouch driver that connect on system COM%2 (Nm9835 serial port #%1)
9835info
if errorlevel 1 goto DONE
@echo Find Nm9835 device.
call 9835set.bat
del  9835set.bat
echo.

if not "%1" == "1" goto NM9835C2
:NM9835C1
echo idTouch /%2 /I%NM9835IRQHEX% /A%NM9835COM1IO%
     idTouch /%2 /I%NM9835IRQHEX% /A%NM9835COM1IO%
goto NM9835Check

if not "%1" == "2" goto Error_Break
:NM9835C2
echo idTouch /%2 /I%NM9835IRQHEX% /A%NM9835COM2IO%
     idTouch /%2 /I%NM9835IRQHEX% /A%NM9835COM2IO%

:NM9835Check
if errorlevel 1 goto NM9835NotFound
if not exist IDTOUCH.VPR  CAL3P
goto DONE

:NM9835NotFound
echo ###  Error! No find the POSTouch controller in Nm9835 first serial port  ###
idTouch /u
goto DONE

:Error_Break
set errorlevel=1
goto DONE

:DONE
@echo on