- 积分
- 616
- 鸿鹄币
- 个
- 好评度
- 点
- 精华
- 注册时间
- 2010-7-3
- 最后登录
- 1970-1-1
- 阅读权限
- 40
- 听众
- 收听
中级工程师
   
|
发表于 2012-7-8 00:07:49
|
显示全部楼层
dyrouter.vbs的内容
#$language = "VBScript"
#$interface = "1.0"
Option Explicit
Function mysubstring(srcString,bChar,eChar)
Dim fIndex,sIndex
fIndex=InStr(srcString,bChar)
sIndex=InStrRev(srcString,eChar)
mysubstring=Mid(srcString,fIndex+1,sIndex-fIndex-1)
End Function
Function ciscoDate()
dim em, y,m,d,h
Dim nowDate
nowDate=Now()
em=Array("January","February","March","April","May","June","July","August","September","October","November","December")
y=Year(nowDate)
m=em(Month(nowDate)-1)
d=Day(nowDate)
h=Time()
ciscoDate=h & " " & m & " " & d & " " & y
End Function
Sub main
On Error Resume Next
crt.Screen.Synchronous = True
crt.Screen.WaitForString "Console port"
crt.Screen.Send VbCr
Dim firstLine
Dim tabTitle
firstLine=crt.Screen.Get2(1,1,1,100)
tabTitle=mysubstring(firstLine,"""","""")
crt.Window.Caption= tabTitle
If crt.Screen.WaitForString("[yes/no]") Then
crt.Screen.Send "no" & VbCr
End If
crt.Screen.Send VbCr &VbCr
crt.Screen.WaitForString "Router>"
crt.Screen.Send "enable" & VbCr
crt.Screen.Send "clock set " & ciscoDate() & VbCr
crt.Screen.Send "conf terminal" & VbCr
crt.Screen.Send "no ip domain-lookup " & VbCr
crt.Screen.Send "hostname " & tabTitle & VbCr
crt.Screen.Send "line con 0" & VbCr
crt.Screen.Send "exec-timeout 0 0" & VbCr
crt.Screen.Send "logging synchronous" & VbCr
crt.Screen.Send "end" & VbCr
crt.Screen.Synchronous = true
End Sub
|
8#
2012-7-8 00:07:49
回复(0)
收起回复
|