如何自动telnet会话没有的SendKeys [英] How To Automate A Telnet Session Without SendKeys
问题描述
我想远程登录到我的路由器,我想这样我就不必登录所有的时间自动执行它,因为我这样做,每天数次。
I would like to telnet into my router, and I want to automate it so I do not have to login all the time, as I do it several times a day.
有另一种方法,除了在VBS的SendKeys?这是因为身体类型,所以Telnet窗口必须是积极的,用的是相当恼人的。
Is there another method apart from sendkeys in VBS? This is because that physically types, so the telnet window needs to be active, with is rather annoying.
我试过一个批处理文件,但我变得非常奇怪的结果。在这里,它是:
I tried a batch file, but I am getting really strange results. Here it is:
telnet 192.168.1.254
REM This is the router IP
ping 255.255.255.255 -n 1 -w 1000 > nul
REM This is to wait for the router if its being slow
George
REM This is the username, as it prompts as soon as it logs in
ping 255.255.255.255 -n 1 -w 1000 > nul
(the password)
ping 255.255.255.255 -n 1 -w 1000 > nul
system
REM Enters the system menu
ping 255.255.255.255 -n 1 -w 10 > nul
debug
REM Enters the Debug menu
ping 255.255.255.255 -n 1 -w 100 > nul
:s
cpu
REM This lets me see the CPU usage
ping 255.255.255.255 -n 1 -w 1000 > nul
REM Wait while it lists it
mem
REM Checks the memory
ping 255.255.255.255 -n 1 -w 1000 > nul
REM Waits again!
goto s
REM I need a loop otherwise I would have to type out lots of code!
下面是结果:
C:\Users\George\Desktop>telnet 192.168.1.254
C:\Users\George\Desktop>telnet 192.168.1.254
^C Terminate batch job (Y/N)?
为什么这样做呢?这将是我期望的结果...
Why is it doing this? This would be my expected result...
Username : George
Password : *******
------------------------------------------------------------------------
______ Technicolor TG582n
___/_____/\
/ /\\ 8.C.M.0.AR
_____/__ / \\
_/ /\_____/___ \ Copyright (c) 1999-2012, Technicolor
// / \ /\ \
_______//_______/ \ / _\/______
/ / \ \ / / / /\
__/ / \ \ / / / / _\__
/ / / \_______\/ / / / / /\
/_/______/___________________/ /________/ /___/ \
\ \ \ ___________ \ \ \ \ \ /
\_\ \ / /\ \ \ \ \___\/
\ \/ / \ \ \ \ /
\_____/ / \ \ \________\/
/__________/ \ \ /
\ _____ \ /_____\/
\ / /\ \ /___\/
/____/ \ \ /
\ \ /___\/
\____\/
------------------------------------------------------------------------
{George}=>system
{George}=>debug
{George}[system debug]=>cpu
CPU (%): Idle User Kernel
57.43 0.99 41.58
{George}[system debug]=>mem
Total: 61280 KB
Used: 45216 KB
by kernel: 30748 KB
by applications: 14468 KB
{George}[system debug]=>
那么,为什么这样做?
So, Why is it doing this?
我可以分开使用另一种方法从的SendKeys?
Can I use another method apart from sendkeys?
推荐答案
您可以谷歌这个工具:它没有剧本窗户TELNET.EXE,但它是一个脚本Telnet客户端。
You can google for this tool: it doesn't script windows telnet.exe but it is a scriptable telnet client.
远程登录脚本工具V.1.0 结果
阿尔伯特耶鲁
Telnet Scripting Tool v.1.0
by Albert Yale
这篇关于如何自动telnet会话没有的SendKeys的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!