DOS/VBS - 用 bat 批處理 實現自動telnet

來源:互聯網
上載者:User

標籤:page   back   home   vbs   size   backspace   object   esc   insert   

一、VBS法

1. 建立一個tel.vbs指令碼

‘建立Shell對象set sh=WScript.CreateObject("WScript.Shell")WScript.Sleep 1000‘向telnet發送我們平時錄入的命令sh.SendKeys "open 192.168.1.16"WScript.Sleep 1000sh.SendKeys "{ENTER}"WScript.Sleep 1000sh.SendKeys "zte{ENTER}"WScript.Sleep 1000sh.SendKeys "zte{ENTER}"WScript.Sleep 1000‘運行cisco的show run命令sh.SendKeys "show run{ENTER}"

2. 建立一個batch_tel.bat指令碼,用於調用tel.vbs

rem 啟動telnetstart telnet.exerem batch telnetcscript //nologo tel.vbs

3. SendKeys命令協助

對於SendKeys這個命令可以send什麼,我們可以看下面的列表:BACKSPACE {BACKSPACE}, {BS}, or {BKSP}BREAK {BREAK}CAPS LOCK {CAPSLOCK}DEL or DELETE {DELETE} or {DEL}DOWN ARROW {DOWN}END {END}ENTER {ENTER}or ~ESC {ESC}HELP {HELP}HOME {HOME}INS or INSERT {INSERT} or {INS}LEFT ARROW {LEFT}NUM LOCK {NUMLOCK}PAGE DOWN {PGDN}PAGE UP {PGUP}PRINT SCREEN {PRTSC}RIGHT ARROW {RIGHT}SCROLL LOCK {SCROLLLOCK}TAB {TAB}UP ARROW {UP}F1 {F1}F2 {F2}F3 {F3}F4 {F4}F5 {F5}F6 {F6}F7 {F7}F8 {F8}F9 {F9}F10 {F10}F11 {F11}F12 {F12}F13 {F13}F14 {F14}F15 {F15}F16 {F16}SHIFT +CTRL ^ALT %

 

DOS/VBS - 用 bat 批處理 實現自動telnet

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.