By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,852 Members | 1,426 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,852 IT Pros & Developers. It's quick & easy.

Perl Telnet to window

P: 1
I am running my perl on linux trying to connect to window via telnet.
How can I overcome the "Mode:" prompt?

as you know when you telnet a window box you will be prompted with "Mode"
I tried below code but it wont work. it's just hang.

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3. use Net::Telnet;
  4. my $t = new Net::Telnet (Timeout => 7200);
  5.  
  6. $t->open("host_name");
  7. $t->waitfor('/Account.Name:.*$/');
  8. $t->print('user_name');
  9.  
  10. $t->waitfor('/Password:.$/');
  11. $t->print('user_password');
  12.  
  13. $t->waitfor('/Mode:.*$/');
  14. $t->print('a');
  15.  
  16. my @lines=$t->cmd("dir");
  17. print @lines;
Jan 9 '08 #1
Share this Question
Share on Google+
2 Replies


eWish
Expert 100+
P: 971
I don't know of a way to overcome this. Were you able to figure out a resolution for this?

--Kevin
Jan 16 '08 #2

Kelicula
Expert 100+
P: 176
I am running my perl on linux trying to connect to window via telnet.
How can I overcome the "Mode:" prompt?

as you know when you telnet a window box you will be prompted with "Mode"
I tried below code but it wont work. it's just hang.

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3. use Net::Telnet;
  4. my $t = new Net::Telnet (Timeout => 7200);
  5.  
  6. $t->open("host_name");
  7. $t->waitfor('/Account.Name:.*$/');
  8. $t->print('user_name');
  9.  
  10. $t->waitfor('/Password:.$/');
  11. $t->print('user_password');
  12.  
  13. $t->waitfor('/Mode:.*$/');
  14. $t->print('a');
  15.  
  16. my @lines=$t->cmd("dir");
  17. print @lines;



Nothing in the Net::Telnet documentation?
Jan 16 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.