I dunno if this would work but try -

telnet 1.2.3.4 < commands.txt

where commands.txt looks like this:
username
password
cd /a/b/c
Cget.pl "hostname"
userID
password2
userid1
password3
quit
I think it'll work when you try that with netcat: http://www.atstake.com/research/tool...ork_utilities/

nc -t -vv 1.2.3.4 23 < commands.txt