From: Zhao Yi Date: 2008-09-07T19:26:24+09:00 Subject: Re: How to telnet to a host? I know what wrong with these code. It is because the password prompt is different with the default one. It works when I set the PasswordPrompt value. But after login, when I run a command I will get time out error. Please see my code: tn=Net::Telnet.new("Host" => "localhost","Timeout" => 10,"Prompt" => /[$%#>] \z/n){|c| print c} tn.login({"Name"=>"user","Password" => "123456","LoginPrompt"=>/[Ll]ogin[: ]*\z/n,"PasswordPrompt"=>/password[: ]*\z/n}){|c| print c} tn.cmd("dir"){|c| print c} -- Posted via http://www.ruby-forum.com/.