扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在以往的学习中,我们对telnet的一些基本介绍,不知道大家是否已经掌握了。telnet服务可以设置自动登录,也可以进行交换机telnet自动登录或者是批处理的有关设置。现在我们来讲解一下H3C交换机telnet自动登录的设置。现在我们就来看一下具体的命令代码吧。
@echo off&SETLOCAL ENABLEDELAYEDEXPANSION
color 7d
echo 实验室网络管理
echo 1:关闭外网 2:打开外网
echo 请输入 1 或 2 进行操作
set/p v=[输入 1/2]
echo.
if /i "%v%"=="1" goto :close
if /i "%v%"=="2" goto :open
goto :exit
:open
echo set sh=WScript.CreateObject("WScript.Shell") >telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "telnet10.20.20.16" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "******{ENTER}">>telnet_tmp.vbs ;*****密码
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "sys{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "interface gigabitethernet */*/*{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "port trunk permit vlan ***{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 500 >>telnet_tmp.vbs
echo sh.SendKeys "del telnet_tmp.vbs{ENTER}" >>telnet_tmp.vbs
start cmd
cscript //nologo telnet_tmp.vbs
goto :exit
:close
echo set sh=WScript.CreateObject("WScript.Shell") >telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "telnet10.20.20.16" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "******{ENTER}">>telnet_tmp.vbs ;*****密码
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "sys{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "interface gigabitethernet */*/*{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "undo port trunk permit vlan ***{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "quit{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 500 >>telnet_tmp.vbs
echo sh.SendKeys "del telnet_tmp.vbs{ENTER}" >>telnet_tmp.vbs
start cmd
cscript //nologo telnet_tmp.vbs
:exit
exit
以上就是H3C交换机telnet自动登录的命令代码了。希望本文能够对大家有所帮助。
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。