Jump to content

Telnet automation: Modem Config


 Share

Recommended Posts

Hi!

I am are trying to send text to a CMD Window and read output.

Look to my code:

#include <Constants.au3>

AutoItSetOption("WinDetectHiddenText", 1)
$cmd = Run(@ComSpec & " /k telnet 10.1.1.1", @WindowsDir, @SW_HIDE, $STDOUT_CHILD)
Sleep(2000)
ControlSend("C:\WINDOWS\system32\cmd.exe", "", 0, "teste" & @CRLF, 0)
Sleep(2000)

While 1
    $output = StdoutRead($cmd)
    If @error Then ExitLoop
    ConsoleWrite($output & @CRLF)
    Sleep(800)
Wend

and I tryed this too:

#include <Constants.au3>

AutoItSetOption("WinDetectHiddenText", 1)
$cmd = Run("C:\Windows\system32\telnet.exe", @WindowsDir, @SW_SHOW, $STDIN_CHILD + $STDOUT_CHILD)
Sleep(2000)
StdInWrite($cmd, "open 10.1.1.1" & @CRLF)
Sleep(2000)

While 1
    $output = StdoutRead($cmd)
    If @error Then ExitLoop
    ConsoleWrite($output & @CRLF)
    Sleep(800)
Wend

I can't send the command to CMD... :evil:

Can someone help me?

Sorry any english grammar errors. ;)

Thanks in advance.

Edited by Splash
Automatic Update UDF - IP Address UDF - WinPcap AutoIt _FindDevice()[font="Verdana"][size="2"]AutoIt Spanish/Brasil/World community!!![/size][/font]Use you wanna a dot.tk domain please use my link:
Link to comment
Share on other sites

Firstly have you tried using Run(@ComSpec & ' /k ' & 'telnet' & ' ' & 'open 10.1.1.1', @SystemDir, @SW_SHOW)

This don't will work... Run command need $STDOUT_CHILD parameter. ;)

Automatic Update UDF - IP Address UDF - WinPcap AutoIt _FindDevice()[font="Verdana"][size="2"]AutoIt Spanish/Brasil/World community!!![/size][/font]Use you wanna a dot.tk domain please use my link:
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...