码迷,mamicode.com
首页 > 其他好文 > 详细

SecureCRT自动备份脚本-华为

时间:2016-10-10 19:21:14      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:

# $language = "VBScript"
# $interface = "1.0"

Sub Main
     
     Const ForReading = 1, ForWriting = 2, ForAppending = 8
     Dim fso,file1,line,str1,params
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set file1 = fso.OpenTextFile("D:\SWbackup\list2.txt",Forreading, False)        
     crt.Screen.Synchronous = True
     do while file1.AtEndOfStream <> True 
        读取每一行
        line = file1.ReadLine   
        分割IP,用户名,密码
        params = Split (line)
        crt.session.LogFileName = "D:\SWbackup\log\" & params(0) & ".txt"
        crt.session.Log(true)
        telnet登录
        crt.Session.Connect "/TELNET " & params(0)
        
        输入用户名
        crt.screen.WaitForString "Username:",1
        crt.screen.send params(1) & Chr(13)
        
        输入密码
        crt.Screen.WaitForString "Password:"
        crt.Screen.Send params(2) & Chr(13)
        进入特权模式(enable)
        crt.Screen.Send "system-view" & Chr(13)
        crt.Screen.waitForString "]"
        执行dis cur命令
        crt.Screen.Send "dis cur" & Chr(13)
        crt.Screen.Send "                                           "
        crt.screen.send Chr(13)
        crt.Screen.waitForString "return" 
        crt.Screen.waitForString "]"
        crt.screen.send Chr(13)
        执行dis ip int b命令 
        crt.Screen.Send "dis ip int b" & Chr(13)
        crt.Screen.Send "                        "
        crt.screen.send Chr(13)
        crt.Screen.waitForString "]" 
        执行dis int b命令
        crt.Screen.Send "dis int b" & Chr(13)        
        crt.Screen.Send "                 "
        crt.screen.send Chr(13)
        crt.Screen.waitForString "]" 
        crt.screen.send Chr(13)
        断开连接
        crt.Session.Disconnect  
    
        loop
        crt.Screen.Synchronous = False     
          
End Sub

 

SecureCRT自动备份脚本-华为

标签:

原文地址:http://www.cnblogs.com/ping-y/p/5946657.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!