SecureCRT自动登录Linux并设置时间

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

crt.Screen.Synchronous = True

' This automatically generated script may need to be
' edited in order to work correctly.

Sub Main
    crt.Screen.WaitForString "Username: "
    crt.Screen.Send "root" & chr(13)
    crt.Screen.WaitForString "Password: "
    crt.Screen.Send "123456789" & chr(13)
    crt.Screen.WaitForString "root> "

    crt.Screen.Send "status" & chr(13)
    crt.Screen.WaitForString "root> "
     
    CurrentYear       = mid(Now, 9, 2)
    CurrentMonth      = mid(Now, 1, 2)
    CurrentDay        = mid(Now, 4, 2)
    CurrentHour       = mid(Now, 12, 2)
    CurrentMinute     = mid(Now, 15, 2)
    CurrentSecond     = mid(Now, 18, 2)
    crt.Screen.Send "date " & CurrentMonth & CurrentDay & CurrentHour & CurrentMinute & CurrentYear & vbcr
    crt.Screen.WaitForString "root> "
    
    crt.Screen.Send "cli" & chr(13)
    crt.Screen.WaitForString "redhat> "
    crt.Screen.Send "en" & chr(13)
End Sub

 

posted @ 2011-10-13 12:09  方倍工作室  阅读(2412)  评论(0编辑  收藏  举报