cmd

windows cmd

自动登录telnet 并执行命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@echo off
echo set sh=WScript.CreateObject("WScript.Shell") >telnet_tmp.vbs

echo WScript.Sleep 1000 >>telnet_tmp.vbs
rem ----------------UNIX IPAddress
echo sh.SendKeys "open 192.168.1.100{ENTER}" >>telnet_tmp.vbs

echo WScript.Sleep 1000 >>telnet_tmp.vbs
rem ----------------userID
echo sh.SendKeys "root{ENTER}" >>telnet_tmp.vbs

echo WScript.Sleep 1000 >>telnet_tmp.vbs
rem ----------------password
echo sh.SendKeys "登录密码{ENTER}" >>telnet_tmp.vbs

echo WScript.Sleep 1000 >>telnet_tmp.vbs

echo sh.SendKeys "/path/你要执行的bin文件 {ENTER}">>telnet_tmp.vbs

start telnet

cscript //nologo telnet_tmp.vbs

rem del telnet_tmp.vbs

推荐文章