那么可以按照下面的步驟進(jìn)行:
1、編寫腳本:
新建一個(gè)文件crt.vbs,尾綴為。vbs,內(nèi)容如下:
#$language = "VBScript"
#$interface = "1.0"
Sub main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
On Error Resume Next
crt.session.Connect("/telnet 11.133.183.251")
If Err.Number<>0 Then
crt.session.Connect("/telnet 11.133.183.251")
End If
crt.Screen.WaitForString "Username:"
crt.Screen.Send "ccie" & VbCr
crt.Screen.WaitForString "Password:"
crt.Screen.Send "ccie " & VbCr
crt.Screen.WaitForString "Router#"
crt.Screen.Send "config t" & VbCr
crt.Screen.WaitForString "Router(config)#"
crt.Screen.Send "int f0/1" & VbCr
crt.Screen.WaitForString "Router(config-if)#"
crt.Screen.Send "no sh" & VbCr
crt.Screen.WaitForString "Router(config-if)#"
crt.Screen.Send "end" & VbCr
crt.Screen.WaitForString "Router#"
crt.Screen.Send "copy run tftp://11.133.183.249" & VbCr
crt.Screen.WaitForString "Address or name of remote host [11.133.183.249]"
crt.Screen.Send ""& VbCr
crt.Screen.WaitForString "Destination filename [router-confg]"
crt.Screen.Send ""& VbCr
Do while (crt.Screen.WaitForString("--- more ---",1)<>False)
crt.Screen.Send " "
Loop
' crt.Screen.Send "exit" & VbCr
crt.session.disconnect
crt.Screen.Synchronous = False
End Sub
北京 | 天津 | 上海 | 江蘇 | 山東 |
安徽 | 浙江 | 江西 | 福建 | 深圳 |
廣東 | 河北 | 湖南 | 廣西 | 河南 |
海南 | 湖北 | 四川 | 重慶 | 云南 |
貴州 | 西藏 | 新疆 | 陜西 | 山西 |
寧夏 | 甘肅 | 青海 | 遼寧 | 吉林 |
黑龍江 | 內(nèi)蒙古 |