@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文件中執(zhí)行Start_vos.vbs文件
我們提供的服務(wù)有:成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、湖北ssl等。為1000多家企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的湖北網(wǎng)站制作公司批處理執(zhí)行文件之前首先需要下載SecureCRT.exe文件
Start_vos.vbs文件內(nèi)容如下:
#$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
上述代碼主要是將手動(dòng)輸入的過(guò)程使用VBS腳本進(jìn)行自動(dòng)化
首先:
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"
將當(dāng)前連接頁(yè)面重命名為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 # "等待頁(yè)面下一行的內(nèi)容為
chr(27) & "[32m(none) /home/test" & chr(27) & "[m # "
標(biāo)題名稱:window下批處理操作:bat文件中調(diào)用vbs-創(chuàng)新互聯(lián)
文章來(lái)源:http://jinyejixie.com/article28/diesjp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、網(wǎng)站維護(hù)、網(wǎng)站改版、動(dòng)態(tài)網(wǎng)站、網(wǎng)站排名、ChatGPT
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容