利用VBS脚本实现Telnet自动连接

时间:2023-03-08 21:48:56

把以下代码保存为*.vbs文件,替换IP、用户名、密码。


Dim objShell
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "cmd.exe",1,False
WScript.Sleep 1000
objShell.SendKeys "telnet 192.168.1.25"
WScript.Sleep 1000
objShell.SendKeys "{ENTER}"
WScript.Sleep 3000
objShell.SendKeys "y"
objShell.SendKeys "{ENTER}"
WScript.Sleep 1000
objShell.SendKeys "User"
objShell.SendKeys "{ENTER}"
WScript.Sleep 1000
objShell.SendKeys "Password"
objShell.SendKeys "{ENTER}"