user1064397
user1064397

Reputation: 15

VBs to log (.txt) telnet output

A very simple script to save time for something i (repeatedly) need to check @ work;

Set cloner = CreateObject("WScript.Shell")  
cloner.SendKeys"telnet 0.0.0.0"  
cloner.SendKeys("{Enter}")  
WScript.Sleep 1000  
cloner.SendKeys("whatever")  

And, i'd like this to output to a .txt.

Upvotes: 1

Views: 6058

Answers (3)

Alex Rudyak
Alex Rudyak

Reputation: 1

Try:

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.run("telnet.exe")  
WScript.Sleep 500

WshShell.SendKeys("set logfile filename.txt{Enter}")
WScript.Sleep 500

WshShell.SendKeys("open 0.0.0.0{Enter}")
WScript.Sleep 500

WshShell.SendKeys("whatever")

this will create a file named filename in the working directory, can be replaced with absolute path aswell.

Upvotes: 0

The Mr. Totardo
The Mr. Totardo

Reputation: 1171

The code just producing a blank txt; no string in it.

Upvotes: 0

Emir Akaydın
Emir Akaydın

Reputation: 5823

try this one

Set cloner = CreateObject("WScript.Shell")
 cloner.Run "cmd.exe"
 WScript.Sleep 1000
 cloner.SendKeys"telnet 0.0.0.0 -f out.txt"
 cloner.SendKeys("{Enter}")
 WScript.Sleep 1000
 cloner.SendKeys("whatever") 

Upvotes: 2

Related Questions