如何将VB脚本的输出写入文件?

时间:2016-09-01 14:57:32

标签: windows shell vbscript telnet

我有一个脚本会将某些命令的值输出到终端吗?有人可以帮我修改脚本以将输出写入文件吗?

:: Open a Telnet window

start telnet.exe 192.168.1.1

:: Run the scrip

cscript SendKeys.vbs



set OBJECT=WScript.CreateObject("WScript.Shell")
WScript.sleep 50 
OBJECT.SendKeys "Administrator{ENTER}" 
WScript.sleep 50 
OBJECT.SendKeys "admin{ENTER}"
WScript.sleep 50 
OBJECT.SendKeys "{ENTER}"

For i = 1 to 10
 i = i - 1
 OBJECT.SendKeys "voice profile list{ENTER}"
 WScript.sleep 5000
 OBJECT.SendKeys "system debug cpu{ENTER}"
  WScript.sleep 2000
 OBJECT.SendKeys "memm stats{ENTER}"
 WScript.sleep 5000
Next

1 个答案:

答案 0 :(得分:0)

您需要“Telnet脚本工具”。我过去曾经使用它,效果很好。 http://support.moonpoint.com/downloads/windows/network/Telnet/tst10.php

如果我没记错的话,如果窗口失去焦点,它也会否定脚本挂起的问题。

tst10.exe /r:script.txt /o:output.txt