傻瓜式设置WANem配置 (点对点网络设置)

5 篇文章 0 订阅
3 篇文章 0 订阅

开放源码 = =~ 转载借用表明原地址 谢谢


之前我们用到怎么配置WANem,下面开放一个傻瓜式工具的源码。

把下列代码拷贝到记事本,修改记事本的后缀名.txt 成 .bat。

然后把这个bat文件拷贝到需要用你的WANem限制的2端PC上

我们称一端为Client端,一端为Server端。

双击这个bat文件就OK啦。

如果系统不包括中文语言包(原装的ENU的XP系统),那请使用下面第2个ENU版的= =~


@echo off
if exist C:\temp.txt del C:\temp.txt
echo 懒人工具之WANem使用设置 ,适用任一语言、任一Win系统Client和Server,自动判断网络环境,一键设置,八心八箭......
set slection1=
set/p slection1=输入你的Client端的IP:
echo %slection1%>C:\temp.txt
for /f "delims=. tokens=3" %%a in (C:\temp.txt) do set x=%%a
del C:\temp.txt
set slection2=
set/p slection2=输入你的Server端(XA or XD)的IP:
echo %slection2%>C:\temp.txt
for /f "delims=. tokens=3" %%a in (C:\temp.txt) do set y=%%a
del C:\temp.txt
set slection3=
set/p slection3=输入你的WANem的IP:
echo %slection3%>C:\temp.txt
for /f "delims=. tokens=3" %%a in (C:\temp.txt) do set z=%%a
del C:\temp.txt
CHOICE /C ASC /M "当前系统是你的Client端选A,是你的Server端(XA or XD)选S,取消选择C"
if %errorlevel% equ 3 goto end
if %errorlevel% equ 2 goto server
if %errorlevel% equ 1 goto client
:client
if %x%==%y% (goto p) else (goto warning)

:p
if %x%==%z% (goto normal) else (goto warningo)

:warning
CHOICE /C YC /M "当前Client端和Server端不在同一网段,强烈建议设置在同一网段,继续选择Y,取消选择C"
if %errorlevel% equ 2 goto end
if %errorlevel% equ 1 goto normalo

:warningo
CHOICE /C YC /M "当前WANem与Server,Client端不在同一网段,强烈建议设置在同一网段,继续选择Y,取消选择C"
if %errorlevel% equ 2 goto end
if %errorlevel% equ 1 goto normalo

:server
echo WANem之Server端设置——
route add %slection1% mask 255.255.255.255 %slection3%
goto end

:normal
echo WANem之Client端设置——
route add %slection2% mask 255.255.255.255 %slection3%
goto end

:normalo
set slection4=
set/p slection4=输入你的Client的Defalut Gateway:
echo WANem之Client端设置——
route add %slection3% mask 255.255.255.255 %slection4%
goto end

:end
echo Good Luck!
pause>nul





ENU版:

@echo off
if exist temp.txt del temp.txt
set slection1=
set/p slection1=Input Client IP:
echo %slection1%>temp.txt
for /f "delims=. tokens=3" %%a in (temp.txt) do set x=%%a
del temp.txt
set slection2=
set/p slection2=Input Server IP:
echo %slection2%>temp.txt
for /f "delims=. tokens=3" %%a in (temp.txt) do set y=%%a
del temp.txt
set slection3=
set/p slection3=Input WANem IP:
echo %slection3%>temp.txt
for /f "delims=. tokens=3" %%a in (temp.txt) do set z=%%a
del temp.txt
CHOICE /C ASC /M "The current system is Client choose A,Server(XA or XD) choose S,Cancel choose C"
if %errorlevel% equ 3 goto end
if %errorlevel% equ 2 goto server
if %errorlevel% equ 1 goto client

:client
if %x%==%y% (goto p) else (goto warning)

:p
if %x%==%z% (goto normal) else (goto warningo)

:warning
CHOICE /C YC /M "The current Client and Server are not in same subnet,suggest to make them in one subnet! Continue:Y,Cancel:C"
if %errorlevel% equ 2 goto end
if %errorlevel% equ 1 goto normalo

:warningo
CHOICE /C YC /M "The current WANem and Server,Client are not in same subnet,suggest to make them in one subnet! ,Continue:Y,Cancel:C"
if %errorlevel% equ 2 goto end
if %errorlevel% equ 1 goto normalo

:server
echo The Configuration of Server:
route add %slection1% mask 255.255.255.255 %slection3%
goto end

:normal
echo The Configuration of Client:
route add %slection2% mask 255.255.255.255 %slection3%
goto end

:normalo
set slection4=
set/p slection4=Input the Defalut Gateway of your Client:
echo The Configuration of Client:
route add %slection3% mask 255.255.255.255 %slection4%
goto end

:end
echo GoodLuck
pause>nul






评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值