0

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!

Matthew Brzezinski
  • 1,685
  • 4
  • 29
  • 53
  • Could you please format this ? Are % or @ or other 'strange' characters in your password ? – Marged Jun 07 '15 at 16:02
  • There are no strange characters, just alphanumerical A-Z and 1-9. This is the script as I wrote it. – GeekSqueak Jun 07 '15 at 16:03
  • Telnet can't see the commands login etc. You could use io redirection and read the commands with telnet ... < commands.txt – Marged Jun 07 '15 at 16:08
  • So I'd write out a commands.txt file and refence it like telnet 62.141.39.173 10011 telnet commands.txt close quit goto start ?? – GeekSqueak Jun 07 '15 at 16:10

1 Answers1

0

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.

Community
  • 1
  • 1
Marged
  • 10,577
  • 10
  • 57
  • 99