In our past studies, we have provided some basic introductions to telnet, but I don't know if you have mastered it. You can set Automatic Logon for the telnet service, switch telnet automatic logon, or batch processing settings. Now let's explain how to set up Automatic Logon Through telnet on the H3C switch. Now let's take a look at the specific command code.
@ Echo off & SETLOCAL ENABLEDELAYEDEXPANSION
Color 7d
Echo lab network management
Echo 1: Disable Internet 2: open Internet
Input 1 or 2 for echo operation.
Set/p v = [enter 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.000016"> 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; ***** Password
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.000016"> 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; ***** Password
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
The preceding command code is used to automatically log on to the H3C switch via telnet. I hope this article will help you.