您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
@echo "kill CRT process" taskkill /F /IM SecureCRT.exe ::ping 127.0.0.1 -n 30 echo "start vos through CRT" echo off d: cd D:\tools\SecureCRT_x86 start SecureCRT.EXE /SCRIPT D:\Secure_vos\Start_vos.vbs echo "start vos through CRT end" ping 127.0.0.1 -n 4 pause
上述代码的意思是:在.bat文件中执行Start_vos.vbs文件
批处理执行文件之前首先需要下载SecureCRT.exe文件
Start_vos.vbs文件内容如下:
#$language = "VBScript" #$interface = "1.0" crt.Screen.Synchronous = True Sub Main On Error Resume Next Dim result If crt.Session.Connected Then crt.Session.Disconnect ' connected to the '172.21.1.114' Set objtab = crt.Session.ConnectInTab("/SSH2 /PASSWORD root root@172.21.1.114",True) ' Capture error code and description (if any) nError = Err.Number strErr = Err.Description ' Now, tell the script host that it should handle errors as usual now: On Error Goto 0 ' change tab name objtab.caption = "Gdb_vos" ' enter the folder crt.Screen.Send "cd /home/test" & chr(13) crt.Screen.WaitForString chr(27) & "[32m(none) /home/test" & chr(27) & "[m # " End Sub
上述代码主要是将手动输入的过程使用VBS脚本进行自动化
首先:
Set objtab = crt.Session.ConnectInTab("/SSH2 /PASSWORD root123 root@172.11.1.15",True)
采用SSH2的方式连接linuxIP地址
172.21.1.114,密码是root123,用户名是root
objtab.caption = "Start_vos"
将当前连接页面重命名为Start_vos
crt.Screen.Send "cd /home/test" & chr(13)输入cd /home/test并回车
crt.Screen.WaitForString chr(27) & "[32m(none) /home/test" & chr(27) & "[m # "等待页面下一行的内容为
chr(27) & "[32m(none) /home/test" & chr(27) & "[m # "
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。