Search code examples
vbscript

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.


Solution

  • 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")