Send commands to Telnet.exe

Dear,

I am trying to open Telnet.exe and try to send commands.

How can I spawn telnet, get the handler and use the handler to send
commands in Windows?

I have tried to send telnet commands using socket (Net/Telnet) and
perfectly works fine. I wanted to know, if there a way similar by
spawning Telnet.exe.

Possibly via Popen?

Or Kernel exec.

Marc H. wrote in post #1062746:

Possibly via Popen?

Class: IO (Ruby 1.9.3)

Or Kernel exec.

Thanks Marc!!!

I tried the below code:

f = IO.popen(“C:/WINDOWS/system32/telnet.exe”)
puts “Parent is #{Process.pid}”

Its opening the Telnet.exe, but how will send and receive commands on
the opened Telnet?

On Jun 6, 2012, at 16:31 , Prajwal Kumar wrote:

f = IO.popen(“C:/WINDOWS/system32/telnet.exe”)
puts “Parent is #{Process.pid}”

Its opening the Telnet.exe, but how will send and receive commands on
the opened Telnet?

Marc gave you exactly what you need to move forward.

At some point in time, you’re going to need to actually learn ruby. I
suggest finding a book or online resource that works for you and reading
it. Twice.