fenglin124 当前离线
上等兵
@echo. @echo. @echo =================================== 枫 林 =================================== @echo. @echo 全自动做数据 @del c:\temp.vbs @echo on error resume next >>c:\temp.vbs @echo dim WshShell>>c:\temp.vbs @echo Set WshShell = WScript.CreateObject("WScript.Shell")>>c:\temp.vbs @echo WshShell.run"cmd.exe">>c:\temp.vbs @echo WshShell.AppActivate"c:\windows\system32\cmd.exe">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"telnet 10.10.150.8">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 100>>c:\temp.vbs @echo WshShell.AppActivate"telnet.exe ">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"ddddd">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"ddddd">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"enable">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"ddddd">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @set /p oltip=请输入OLT的IP地址: @set /p boardid=请输入epon-olt接口: @set /p portid=请输入PON口: @set /p onuid=请输入onuID: @set /p mgmvlan=请输入网管vlan: @set /p onuip=请输入onu-ip: @set /p gwy=请输入网关: @set /p vlan=请输入外层vlan: @set /p vlan1=请输入用户vlan: @set /a vlan2=%vlan1%+1 @set /a vlan3=%vlan2%+1 @set /a vlan4=%vlan3%+1 @set /a vlan5=%vlan4%+1 @set /a vlan6=%vlan5%+1 @set /a vlan7=%vlan6%+1 @set /a vlan8=%vlan7%+1 @set /a vlan9=%vlan8%+1 @set /a vlan10=%vlan9%+1 @set /a vlan11=%vlan10%+1 @set /a vlan12=%vlan11%+1 @set /a vlan13=%vlan12%+1 @set /a vlan14=%vlan13%+1 @set /a vlan15=%vlan14%+1 @set /a vlan16=%vlan15%+1 @set /a vlan17=%vlan16%+1 @set /a vlan18=%vlan17%+1 @set /a vlan19=%vlan18%+1 @set /a vlan20=%vlan19%+1 @set /a vlan21=%vlan20%+1 @set /a vlan22=%vlan21%+1 @set /a vlan23=%vlan22%+1 @set /a vlan24=%vlan23%+1 @set /p onutype=请输入设备型号(5612,5626): @if %onutype%==5612 (set /a onu=0) @if %onutype%==5626 (set /a onu=1) @set /p onumac=请输入ONU-MAC(杠分): @echo WshShell.SendKeys"telnet %oltip%">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 100>>c:\temp.vbs @echo WshShell.AppActivate"telnet.exe ">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"username">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"password">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"enable">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"config">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"service-port vlan %vlan% epon %boardid%/%portid% ont %onuid% multi-service user-vlan %vlan1% tag-transform default">>c:\temp.vbs ##这是一条service命令 @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"service-port vlan %vlan% epon %boardid%/%portid% ont %onuid% multi-service user-vlan %vlan2% tag-transform default">>c:\temp.vbs ##这是一条service命令 @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs ####上面标记的service命令如果只有一条的话,下面的telnet就可以执行下去,像这样有两条的话,执行到输入用户名的地方程序就停止执行 @echo WshShell.SendKeys"telnet %onuip% 23">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs 以下代码执行不去,程序卡住 @echo WshShell.SendKeys"username">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"password">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"enable">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"config">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"board confirm 0">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"vlan %vlan1% to %vlan24% mux">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"y">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"port vlan %vlan1% to %vlan24% 0/0 %onu%">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @echo WshShell.SendKeys"y">>c:\temp.vbs @echo WshShell.SendKeys"{ENTER}">>c:\temp.vbs @echo WScript.Sleep 200>>c:\temp.vbs @call c:\temp.vbs复制代码
TOP
hanyeguxing (寒夜孤星)当前离线
荣誉版主
@echo off&setlocal enabledelayedexpansion set /p vlan1=请输入用户vlan: for /l %%a in (2,1,24) do set/a vlan%%a=vlan1-1+%%a复制代码