I have a batch file that contain:
@echo off start telnet x.x.x.x 5000 cscript script_test.vbs
while script_test.vbs contains:
Do not use SendKeys for automating the telnet command that ships with Windows. Use a telnet command that is actually scriptable, like plink from the PuTTY suite.
SendKeys
telnet
plink -batch -telnet -l USERNAME -pw PASSWORD x.x.x.x COMMAND1