madmatrix Posted August 12, 2008 Share Posted August 12, 2008 I'm using cmd.exe to telnet some host. And that host will pop up with user name and password. After that, I will match the string to know what I should input. But when I run cmd.exe and send "telnet host", the user and password pompt wasn't captured and the telnet window also was closed. I want the telnet windows stay on. Then I can watch what the script is doing. Here is my simple start code: Local $foo = Run(@ComSpec & " /c " & "cmd.exe", @SystemDir, @SW_MAXIMIZE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($foo, "telnet host" & @CRLF) StdinWrite($foo) ; Read from child's STDOUT and show Local $data While True $data &= StdoutRead($foo) If @error Then ExitLoop Sleep(25) WEnd MsgBox(0, "Debug", $data) Link to comment Share on other sites More sharing options...
Andreik Posted August 12, 2008 Share Posted August 12, 2008 Try this: #include <Process.au3> _RunDOS("telnet host >" & @TempDir & "\telnet.txt") $FILE = FileOpen(@TempDir & "\telnet.txt",0) $OUT = FileRead($FILE) FileClose($FILE) MsgBox(0,"OUT",$OUT) When the words fail... music speaks. Link to comment Share on other sites More sharing options...
madmatrix Posted August 13, 2008 Author Share Posted August 13, 2008 Try this: #include <Process.au3> _RunDOS("telnet host >" & @TempDir & "\telnet.txt") $FILE = FileOpen(@TempDir & "\telnet.txt",0) $OUT = FileRead($FILE) FileClose($FILE) MsgBox(0,"OUT",$OUT) Thank you. But I tried and nothing captured. It's weired. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now