应用简介
静态路由快速配置工具是一款功能十分强大的家庭路由器配置管理工具,用户可通过这款软件快速地查看路由器的连接线路,能够根据用户的需求自定义调整路由器的添加和删除操作,可实现批量处理和自动输入,满足用户的对路由器的配置管理需求。
【功能介绍】
1、添加路由
2、删除路由
3、查看路由
4、手动添加路由
5、手动删除路由
6、恢复默认设置
【代码介绍】
@echo off
rem //设置变量
rem //以下属性值可以根据需要更改
rem //掩码
set MASK=255.255.255.0
rem //网关
set GATEWAY=192.168.1.1
color 2f
mode con cols=80
title 静态路由快速配置工具 Ver:1.0 %date% by:52pojie.cn@ggm
net.exe session 1>NUL 2>NUL && (
goto as_admin
) || (
goto not_admin
)
:not_admin
echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
echo 本程序需要需要管理员权限!
echo.
echo 即将获取管理员权限!请在弹出的窗口点击“是”!
echo.
echo 获取成功后将自动重启程序,左上角会显示管理员!
echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
pause
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
goto sc_top
:as_admin
:sc_top
cls
echo.&echo.
echo 静态路由配置
echo.
echo --------------------------------------------
echo.&echo.&echo.
echo 1、添加路由
echo.
echo 2、删除路由
echo.
echo 3、查看路由
echo.
echo 4、手动添加路由
echo.
echo 5、手动删除路由
echo.
echo 6、恢复默认设置
echo.&echo.&echo.&echo.&echo.
set select=
set str1=123456
set /p select= 输入数字,按回车:
if not defined select goto sc_wrong
echo %select%|findstr "[%str1%]">nul||goto sc_wrong
if %select%==1 (goto sc_add)
if %select%==2 (goto sc_del)
if %select%==3 (goto sc_print)
if %select%==4 (goto sc_madd)
if %select%==5 (goto sc_mdel)
if %select%==6 (goto sc_reset)
:sc_wrong
mshta vbscript:msgbox("只能输入0-6的数字",64,"提示")(window.close)
goto sc_top
:sc_add
cls
echo 正在添加
route add -p 192.168.10.0 mask %MASK% %GATEWAY%
route add -p 192.168.11.0 mask %MASK% %GATEWAY%
route add -p 192.168.12.0 mask %MASK% %GATEWAY%
route add -p 192.168.13.0 mask %MASK% %GATEWAY%
route add -p 192.168.14.0 mask %MASK% %GATEWAY%
route add -p 192.168.15.0 mask %MASK% %GATEWAY%
route add -p 192.168.16.0 mask %MASK% %GATEWAY%
route add -p 192.168.17.0 mask %MASK% %GATEWAY%
route add -p 192.168.18.0 mask %MASK% %GATEWAY%
route add -p 192.168.19.0 mask %MASK% %GATEWAY%
route add -p 192.168.20.0 mask %MASK% %GATEWAY%
route add -p 192.168.21.0 mask %MASK% %GATEWAY%
route add -p 192.168.22.0 mask %MASK% %GATEWAY%
route add -p 192.168.23.0 mask %MASK% %GATEWAY%
route add -p 192.168.24.0 mask %MASK% %GATEWAY%
route add -p 192.168.25.0 mask %MASK% %GATEWAY%
route add -p 192.168.26.0 mask %MASK% %GATEWAY%
route add -p 192.168.27.0 mask %MASK% %GATEWAY%
route add -p 192.168.28.0 mask %MASK% %GATEWAY%
route add -p 192.168.29.0 mask %MASK% %GATEWAY%
echo 添加完成,按任意键查看路由表
pause>nul
cls
route print
echo 按任意键返回主菜单
pause>nul
goto sc_top
:sc_del
cls
echo 正在删除
route delete -p 192.168.10.0 mask %MASK% %GATEWAY%
route delete -p 192.168.11.0 mask %MASK% %GATEWAY%
route delete -p 192.168.12.0 mask %MASK% %GATEWAY%
route delete -p 192.168.13.0 mask %MASK% %GATEWAY%
route delete -p 192.168.14.0 mask %MASK% %GATEWAY%
route delete -p 192.168.15.0 mask %MASK% %GATEWAY%
route delete -p 192.168.16.0 mask %MASK% %GATEWAY%
route delete -p 192.168.17.0 mask %MASK% %GATEWAY%
route delete -p 192.168.18.0 mask %MASK% %GATEWAY%
route delete -p 192.168.19.0 mask %MASK% %GATEWAY%
route delete -p 192.168.20.0 mask %MASK% %GATEWAY%
route delete -p 192.168.21.0 mask %MASK% %GATEWAY%
route delete -p 192.168.22.0 mask %MASK% %GATEWAY%
route delete -p 192.168.23.0 mask %MASK% %GATEWAY%
route delete -p 192.168.24.0 mask %MASK% %GATEWAY%
route delete -p 192.168.25.0 mask %MASK% %GATEWAY%
route delete -p 192.168.26.0 mask %MASK% %GATEWAY%
route delete -p 192.168.27.0 mask %MASK% %GATEWAY%
route delete -p 192.168.28.0 mask %MASK% %GATEWAY%
route delete -p 192.168.29.0 mask %MASK% %GATEWAY%
echo.
echo 删除完成,按任意键查看路由表
pause>nul
cls
route print
echo.
echo 按任意键返回主菜单
pause>nul
goto sc_top
:sc_print
cls
route print
echo.
echo 按任意键返回主菜单
pause>nul
goto sc_top
:sc_madd
cls
rem //设置IP地址
echo 输入IP地址(例如192.168.1.100/192.168.1.0)
set /p addr=
rem //设置子网掩码
echo 输入子网掩码(例如255.255.255.0)
set /p mask=
rem //设置网关
echo 输入网关(例如192.168.1.1)
set /p gateway=
echo 正在添加,请稍等...
rem //可以根据你的需要更改
echo IP地址 = %addr%
echo 掩码 = %mask%
echo 网关 = %gateway%
route add -p %addr% mask %mask% %gateway%
echo 已执行!
echo.
echo 按任意键返回主菜单
pause>nul
goto sc_top
:sc_mdel
cls
rem //设置IP地址
echo 输入IP地址(例如192.168.1.100/192.168.1.0)
set /p addr=
rem //设置子网掩码
echo 输入子网掩码(例如255.255.255.0)
set /p mask=
rem //设置网关
echo 输入网关(例如192.168.1.1)
set /p gateway=
echo 正在删除,请稍等...
rem //可以根据你的需要更改
echo IP地址 = %addr%
echo 掩码 = %mask%
echo 网关 = %gateway%
route add -p %addr% mask %mask% %gateway%
echo 已执行!
echo.
echo 按任意键返回主菜单
pause>nul
goto sc_top
:sc_reset
cls
echo 正在恢复默认设置,请稍等...
netsh int ipv4 reset
echo 已恢复默认设置!
echo.
echo 按任意键返回主菜单
pause>nul
goto sc_top