@echo off

Set /P ip="Please enter IP-Address (xxx.xxx.xxx.xxx):"  || Set ip=""
IF DEFINED "%ip%" (
    ECHO "Error! No ip-address entered."
    EXIT /b -1
)

Set /P tcp="Please TCP link (0-5):"  || (
    ECHO "Error! No TCP link entered."
    EXIT /b -1
)
ECHO %tcp% | FINDSTR /r "[0-5]" >nul 2>&1 || (
    ECHO "Error! Invalid TCP link"
    EXIT /b -1
)

SET /P spw="Please SPW link (0-2):"  || (
    ECHO "Error! No SPw link entered."
    EXIT /b -1
)
ECHO %spw% | FINDSTR /r "[0-2]" >nul 2>&1 || (
    ECHO "Error! Invalid SPW link"
    EXIT /b -1
)

:: Setup host to target
SET /A tcp_tbl="tcp + 16"
FOR /L %%A IN (0,1,255) DO (
    set_route.exe %ip% %tcp% %%A %spw% spw 0 1 0 %tcp_tbl%
)

:: Setup target to host
FOR /L %%A IN (0,1,255) DO (
    set_route.exe %ip% %tcp% %%A %tcp% tcp 0 1 0 %spw%
)

set_route.exe %ip% %tcp% save
