jozefn has asked for the wisdom of the Perl Monks concerning the following question:

Group, I have a very simple task ( I thought would be simple). I need to telnet into a box and do a "type file_to_type". I log in successfully, but no matter what I do I can not get the type of the file. I have done a $t->print(String=>'type file_to_type'); I have been up one side and down the other with $t->cmd. I am at a loss. Has anyone done this type of thing before on Windows 2000 - works perfectly on unix. Thanks.
my $cmd = 'type \\PROGRA~1\\Mitel\\OPSManager\\Data\\export.out'; $t = new Net::Telnet (Timeout => 10, Prompt => '/[>] $/'); $t->dump_log($dump_file); $t->input_log($input_log); $t->open("10.0.75.1"); $t->waitfor(String=>"login"); $t->print($username); $t->waitfor(String=>"password"); $t->print($passwd); $t->waitfor(String=>">"); @lines = $t->cmd(String=>$cmd, Prompt => '/\\[a-zA-Z0-9]*> $/', Timeout=>500);

Replies are listed 'Best First'.
Re: Net::Telnet windows 2000 craziness
by Rex(Wrecks) (Curate) on Jun 28, 2002 at 01:43 UTC
    Try using the $fh = $obj->dump_log; method and see what is happening. Also look into using the
    $ok = $obj->cmd(String => $string, [Output => $ref,] [Prompt => $match,] [Timeout => $secs,] [Cmd_remove_mode => $mode,]);
    instead of $obj->print and $obj->waitfor.

    I use Net::Telnet on Win2k all the time with great success, the other thing you might look for is your prompts, make sure they will match.

    "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!