Creating a script for a Telnet session?

前端 未结 11 1921
孤街浪徒
孤街浪徒 2020-11-30 02:16

Does anyone know of an easy way to create a script that can connect to a telnet server, do some usual telnet stuff, and then log off? I am dealing with users who are not fa

11条回答
  •  無奈伤痛
    2020-11-30 02:45

    This vbs script reloads a cisco switch, make sure telnet is installed on windows.

    Option explicit
    Dim oShell
    set oShell= Wscript.CreateObject("WScript.Shell")
    oShell.Run "telnet"
    WScript.Sleep 1000
    oShell.Sendkeys "open 172.25.15.9~"
    WScript.Sleep 1000
    oShell.Sendkeys "password~"
    WScript.Sleep 1000
    oShell.Sendkeys "en~"
    WScript.Sleep 1000
    oShell.Sendkeys "password~"
    WScript.Sleep 1000
    oShell.Sendkeys "reload~"
    WScript.Sleep 1000
    oShell.Sendkeys "~"
    Wscript.Quit
    

提交回复
热议问题