Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Batch operation under window: call vbs in bat file

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

@ echo "kill CRT process" taskkill / F / IM SecureCRT.exe::ping 127.0.0.1-n 30echo "start vos through CRT" echo offd:cd D:\ tools\ SecureCRT_x86start SecureCRT.EXE / SCRIPT D:\ Secure_vos\ Start_vos.vbsecho "start vos through CRT end" ping 127.0.0.1-n 4pause

The above code means: execute the Start_vos.vbs file in the .bat file

You first need to download the SecureCRT.exe file before batch execution.

The Start_vos.vbs file is as follows:

# $language = "VBScript" # $interface = "1.0" crt.Screen.Synchronous = TrueSub 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

The above code is mainly used to automate the manual input process using VBS scripts.

First of all:

Set objtab = crt.Session.ConnectInTab ("/ SSH2 / PASSWORD root123 root@172.11.1.15", True)

Connect the linuxIP address by SSH2

172.21.1.114, password is root123, user name is rootobjtab.caption = "Start_vos"

Rename the current connection page to Start_vos

Crt.Screen.Send "cd / home/test" & chr (13) enter cd / home/test and enter enter

Crt.Screen.WaitForString chr (27) & "[32m (none) / home/test" & chr (27) & "[m #" waiting for the next line of the page is chr (27) & "[32m (none) / home/test" & chr (27) & "[m #"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report