利用批处理脚本自动登陆telnet
对于菜鸟级的用户,你跟他说进去cisco的路由器里面reload一下,十有八九他听不懂你说什么,有时候有电话中说半天对方也没明白,倒不如简简单单扔个批处理给他双击一运行就完事了。其实日常使用中批处理大有可为,简单修改一下,telnet进路由器就可以轻松完成配置工作,什么更改pppoe拨号设置啊,修改mtu啊,甚至完整配置一台CISCO都可以用批处理自动完成。
以下为telnet进路由器的批处理:
@echo off
set hostip=192.168.0.1
set username=admin
set password=admin
set /a sleeptime=1000
echo Set WshShell = CreateObject("WScript.Shell")
>%tmp%tel_%hostip%.vbs
echo WshShell.Run "telnet %hostip%"
>>%tmp%tel_%hostip%.vbs
echo WScript.Sleep(%sleeptime%)
>>%tmp%tel_%hostip%.vbs
echo WshShell.SendKeys "%username%{enter}"
>>%tmp%tel_%hostip%.vbs
echo WScript.Sleep(%sleeptime%)
>>%tmp%tel_%hostip%.vbs
echo WshShell.SendKeys "%password%{enter}"
>>%tmp%tel_%hostip%.vbs
echo WScript.Sleep(%sleeptime%)
>>%tmp%tel_%hostip%.vbs
start cscript /nologo %tmp%tel_%hostip%.vbs