Automatic logon to Telnet batch file

Source: Internet
Author: User

Automatic logon to Telnet batch file
One. Windows platform:
Copy the code into Notepad and save it as Autotelnet.bat, then double-click Run to automatically log on to the Telnet server, the server IP to modify itself
@echo off
Echo Set Sh=wscript.createobject ("Wscript.Shell") >telnet_tmp.vbs
Echo Wscript.Sleep >>telnet_tmp.vbs
Echo Sh. SendKeys "Open 192.168.1.200" >>telnet_tmp.vbs
Echo Wscript.Sleep >>telnet_tmp.vbs
Echo Sh. SendKeys "{ENTER}" >>telnet_tmp.vbs
Echo Wscript.Sleep >>telnet_tmp.vbs
Echo Sh. SendKeys "Engineer{enter}" >>telnet_tmp.vbs
Echo Wscript.Sleep >>telnet_tmp.vbs
Echo Sh. SendKeys "ls {ENTER}" >>telnet_tmp.vbs
Start Telnet
cscript//nologo Telnet_tmp.vbs
Del Telnet_tmp.vbsAppendix:for SendKeys This command can send what, we can look at the following list:BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
Break {Break}
CAPS LOCK {CAPSLOCK}
del or DELETE {delete} or {DEL}
ARROW {down}
End {END}
ENTER {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 {ScrollLock}
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%two. Linux platforms
ensure that your system exists expect this executable program, save the following code to the file autotelnet, and give the Execute permission. Detailed Operation view command expect#!/usr/bin/expect--
Set SERVER "192.168.1"
Set USER "MyUserName"
Set PASSWD "Mypass"
If {$ARGC} {
Spawn telnet $SERVER. $argv
} else {
Spawn Telnet $SERVER. 200
}
Expect "Password:"
Send "$PASSWD \ n"
Expect "#"
Send "ls\n"
Interact

Automatic logon to Telnet batch file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.