根据你的描述,按照自己的理解,简单做了修改和简化。
@
echo off & setlocal enabledelayedexpansion
PUSHD %~DP0
TITLE 双网卡配置脚本
mode con cols=60 lines=32
color 3e
set "routes=10.10.6.0 10.10.7.0 10.10.8.0 10.10.9.0 10.10.10.0 10.10.11.0 10.10.12.0 10.10.13.0 10.10.14.0 192.168.200.0 192.168.22.0 192.168.201.0"
:menu
cls
echo.
echo. 请选择所处内网网段
echo ---------------------------
echo.
set _id=
for %%s in (%routes%) do (
set /a _id+=1
echo !_id! %%s
set _route=%%s
set gateway#!_id!=!_route:~0,-2!.1
)
echo.
echo.
echo q 退出
echo.
echo d 删除路由表
echo.
echo ---------------------------
echo.
set /p ID= 请输入序号:
if /i "%ID%"=="q" goto :eof
if /i "%ID%"=="d" goto delete_routes
if not defined gateway#%ID% goto menu
:add_routes
for %%a in (%routes%) do (
route -p add %%a mask 255.255.255.0 !gateway#%ID%!
echo 已添加路由: %%a !gateway#%ID%!
)
echo. 添加完成
timeout /t 50 >nul
goto menu
:delete_routes
for %%r in (%routes%) do (
route delete %%r
echo 已删除路由: %%r
)
echo. 删除完成
timeout /t 1 >nul
goto :menu