How to write an output of a VB script to a file?

回眸只為那壹抹淺笑 提交于 2019-12-06 16:09:04

问题


I have a script which will output the values of certain commands to the terminal?Can anyone help me to modify the script to write the output to a file?

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


The "Telnet Scripting Tool" is what you need. I have used it in the past, and it works great. http://support.moonpoint.com/downloads/windows/network/Telnet/tst10.php

And if I recall correctly, it also negates the issue of the script hanging if the window loses focus.

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


来源:https://stackoverflow.com/questions/39274914/how-to-write-an-output-of-a-vb-script-to-a-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!