標籤: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