How to write an output of a VBscript to a file?

2020-08-01 07:14发布

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条回答
姐就是有狂的资本
2楼-- · 2020-08-01 07:29

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
查看更多
登录 后发表回答