BATCH TELNET (Telnet Automation)

zhaozj2021-02-16  94

Generally speaking, FTP is very common when BATCH is working. So if the Batch Telnet makes our management work more easily?

Generally speaking two methods:

1, VBS method (Windows Script Host)

2, automatic terminal method (some terminals that can be configured automatic Telnet)

Here we discuss the first method: VBS method. Since Windows Script Host is self-contained, we don't need to install local software. So it is generally the first choice for solving problems.

First, we create a script called Tel.vbs, here as an example on Telnet to the Cisco router, the relevant content can be modified.

'Establishing Shell object set sh = wscript.createObject ("wscript.shell") WScript.sleep 1000' Send us to Telnet Sh.sendKeys "open 192.168.1.1" wscript.sleep 1000sh.sendKeys "{entry}" WScript.Sleep 1000sh.SendKeys "password {ENTER}" WScript.Sleep 1000sh.SendKeys "en {ENTER}" WScript.Sleep 1000sh.SendKeys "passord {ENTER}" WScript.Sleep 1000 'show run command run the cisco sh.SendKeys "show run {entry"

Then, create a batch file for batch_tel.bat:

Rem start telnetstart telnet.exerem Batch TelnetCScript // NOLOGO TEL.VBS

Finally, we only need to run Batch_tel.bat to easily get Telnet's work.

For sendKeys, you can see what, we can look at the list below:

BACKSPACE {BACKSPACE}, {BS}, or {bksp} Break {Break} Caps Lock {Capslock} DEL or DELETE {DELETE} or {del} DELETE} or {DEL} DELETE} ENTER {ENTER} OR ~ ESC {ENTER} or ~ ESC {ESC } HELP {HELP} HOME {HOME} INS or INSERT {INSERT} or {INS} LEFT ARROW {LEFT} NUM LOCK {NUMLOCK} PAGE DOWN {PGDN} PAGE UP {PGUP} PRINT SCREEN {PRTSC} RIGHT ARROW {RIGHT} SCROLL Lock {scrollock} tab {tab} UP arrow {UP} f1 {f1} f2 {f2} f3 {f3} f4 {f4} f5 {f5} f6 {f6} f7 {f7} f8 {f8} f9 {f9} f10 {F10} f11 {f11} f12 {f12} f13 {f13} f14 {f14} f15 {f15} f16 {f16}

Shift ctrl ^ alt%

转载请注明原文地址:https://www.9cbs.com/read-10521.html

New Post(0)