Jump to content
Sign in to follow this  
JackDinn

telnet commands

Recommended Posts

JackDinn

hi,

im trying to think of the best way to send a handful of command in telnet :-

telnet 192.168.1.254

SuperUser

password

ppp ifdetach intf = O2_ADSL

ppp ifattach intf = O2_ADSL

exit

iv never had to do more that one CMD command at a time so im not sure of the best way, i would also like to be able to see the cmd window to begin with but be able to hide it after its working properly.

cheers.


Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Share this post


Link to post
Share on other sites
JackDinn

yep there's plenty of people asking similar questions and they all have different answers, iv tried loads now but its over my head :) i had searched before asking but i was stumped then & i still am.

best i can do is

run(@ComSpec & " /c" & "telnet 192.168.1.254","")
WinWait('Telnet 192.168.1.254')
WinActivate("Telnet 192.168.1.254")
send ("SuperUser{ENTER}")
sleep(1000)
WinActivate("Telnet 192.168.1.254")
send ("password{ENTER}")
sleep(1000)
WinActivate("Telnet 192.168.1.254")
send ("ppp ifdetach intf = O2_ADSL{ENTER}")
sleep(5000)
WinActivate("Telnet 192.168.1.254")
send ("ppp ifattach intf = O2_ADSL{ENTER}")
sleep(1000)
WinActivate("Telnet 192.168.1.254")
send ("q{ENTER}")
WinClose("Telnet 192.168.1.254")
Exit

a really bad method as it shows the command window and if someone clicks anything else it has a good chance of sending the keys to the wrong place.

also tried to make a batch file with a separate command file "infile.txt"

telnet 192.168.1.254 < infile.txt

but again although the net says it should work, but it dont.

tried this to

TCPStartup() 
$Socket = TCPConnect("192.168.1.254", 23)
TCPSend($Socket, "SuperUser")
TCPSend($Socket, "password");etc

but no go.

But im still searching.

Edited by JackDinn

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.