Automating Telnet Scripts from .bat with a teamspeak instance

2.4k views Asked by At

Functional part of the script:

telnet 62.141.39.173 10011

login serveradmin passwordredactedforsecurityreasons

gm msg=test Message\\sAll

This works when I paste it directly into CMD, but not when I execute it from a .bat file. I'm not sure why this is, and I need a workaround.

The second part of my problem is that I need to automate this process, and have it loop every ten minutes. This a) won't work in a .bat file for reasons explained above and b) won't even register.

:start

timeout /T 600

telnet 62.141.39.173 10011 

login serveradmin passwordredactedforsecurityreasons

gm msg=test Message\\sAll

close

quit

goto start

Help!

1

There are 1 answers

2
Marged On

Try it this way. Put the commands into a simple textfile:

commands.txt:

login serveradmin passwordredactedforsecurityreasons
gm msg=test Message\sAll
close

And then call telnet like this:

telnet 62.141.39.173 10011 < commands.txt

I don't need to mention that using telnet to transfer passwords unencrypted is not a good idea ? ;-)

If this does not work (unfortunately I have no telnet server at hand to test with), perhaps this SO post has the right answer for you: How To Automate A Telnet Session Without SendKeys

If your server is reachable on the Internet, I recommend you not to send any password through telnet. If this is an option, better tunnel the data through ssh and expose only those teamspeak functions that need to be available via telnet.