【问题标题】:How to write an output of a VB script to a file?如何将VB脚本的输出写入文件?
【发布时间】:2017-01-09 12:54:29
【问题描述】:

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

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

【问题讨论】:

  • 这行不通。使用实际上可编写脚本的telnet 命令(如plink)。

标签: windows shell vbscript telnet


【解决方案1】:

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

如果我没记错的话,如果窗口失去焦点,它也可以解决脚本挂起的问题。

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

【讨论】:

    猜你喜欢
    • 2014-09-02
    • 1970-01-01
    • 2011-04-17
    • 2019-03-16
    • 2015-08-22
    • 1970-01-01
    • 1970-01-01
    • 2014-03-24
    • 1970-01-01
    相关资源
    最近更新 更多