crt gns连接 crt 不能在crt标签那显示设备名

 
gns路径在这要这么些  :
start D:\SecureCRT\SecureCRT.EXE /script D:\SecureCRT\Scripts\DyRouter.vbs /arg %d /T /telnet %h %p
 
脚本名字===当然随你放在哪里都行
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 "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.Send "clock set " & ciscoDate() & VbCr
   crt.Screen.Synchronous = False
End Sub
 
 
先写个txt然后改个名字 类型需要注意下 别的不多讲
 

本文出自 “荒原” 博客,谢绝转载!

你可能感兴趣的:(标签,language,interface,start,休闲)