Jump to content

Recommended Posts

Posted

OK... I can't seem to interface with command prompt.

I have numerous devices that I can interface via telnet through the command prompt.

They also have web interfaces but that takes much more time to communicate with.

I've searched through these forums and I thought I could use something like the StdinWrite / StdoutRead but that doesn't seem to work too well.

Or maybe I am using them wrong.

Heres the code I've been trying to get to work:

#include <Constants.au3>

$foo = Run("cmd.exe", "", @SW_MAXIMIZE, $STDIN_CHILD + $STDOUT_CHILD)

Sleep(200)
StdinWrite($foo, "telnet 10.10.10.1" & @CRLF)
Sleep(5000)
StdinWrite($foo, "password" & @CRLF)
Sleep(5000)

StdinWrite($foo)

MsgBox(0, "Debug", StdoutRead($foo))

I'm trying to send the line: telnet 10.10.10.1

and then wait for the password prompt and send: password

Then wait a little bit longer and just read what's on the command prompt.

Any suggestions would be greatly appreciated. Thanks!

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
  • Recently Browsing   0 members

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