Liu Nuaadupu
2010-01-13 06:05:14 UTC
telnet = Net::Telnet::new("Host" => "192.168.0.16",
"Timeout" => 10,
"Prompt" => /[$%#>] \z/n)
telnet.login("username", "password") { |c| print c }
result = telnet.cmd("c:\test.bat")
telnet.close
how to judge the result of the batch?
If from the result variable you must know the true result.
If from the command [telnet.cmd("echo %ERRORLEVEL")],to make sure that
there is not any exit command in the windows batch script.
have any other good idears?
"Timeout" => 10,
"Prompt" => /[$%#>] \z/n)
telnet.login("username", "password") { |c| print c }
result = telnet.cmd("c:\test.bat")
telnet.close
how to judge the result of the batch?
If from the result variable you must know the true result.
If from the command [telnet.cmd("echo %ERRORLEVEL")],to make sure that
there is not any exit command in the windows batch script.
have any other good idears?
--
Posted via http://www.ruby-forum.com/.
Posted via http://www.ruby-forum.com/.