SecureCRT 修改时间脚本

来源:互联网 发布:医药行业erp软件 编辑:程序博客网 时间:2024/05/16 04:33

脚本:

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

Sub main
  ' turn on synchronous mode so we don't miss any data
  crt.Screen.Synchronous = True

  ' Wait for a string that looks like "login: " or "Login: "

  ' Send your username followed by a carriage return
  Dim i
  i = 0
 
  DO while i < 10
    'crt.sleep 2000
    crt.Screen.Send "date -s '2012-12-12 12:12:12'" & VbCr
    crt.Screen.WaitForString "#"
 crt.sleep 2000
    crt.Screen.Send "date -s '1970-01-12 12:12:12'" & VbCr
 crt.Screen.WaitForString "#"
 crt.sleep 2000
    i = i + 1 
  LOOP
  ' Wait for a string that looks like "password: " or "Password: "
  'crt.Screen.WaitForString "assword:"

  ' Send your password followed by a carriage return
  'crt.Screen.Send "password" & VbCr

  ' turn off synchronous mode to restore normal input processing
  crt.Screen.Synchronous = False
End Sub

说明:

1.不同系统使用date设置的命令方法不一样。

2.设置时间可能导致某些系统异常。

3.这里只是列举简单的脚本。

4.在SecureCRT中,用户也可以录制脚本,这样再看懂写法就可以自己写简单的VB&SecureCRT结合的脚本了。

原创粉丝点击