@rem = '--*-Perl-*-- @echo off perl "%~dpnx0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl @rem '; #!perl #line 8 use strict; use warnings; use Term::ReadKey; use Net::Telnet (); use Win32::Console; my $CON = new Win32::Console(STD_OUTPUT_HANDLE); my @info = $CON->Info; my $w = $info[0]; print 'Enter Username: '; my $user = ; chomp $user; print "Enter Password: "; ReadMode ('noecho'); my $pass = ; chomp $pass; ReadMode ('restore'); print "\n"; my $machine = 'corus'; my @lines; my $t = new Net::Telnet (Timeout => 3600, Input_log => "c:/ftp/telnet.log"); $t->open($machine); $t->login($user, $pass); @lines = $t->cmd("ps -ef | grep $user"); pop @lines; for ( @lines ) { my $line = $_; chomp $line; my $prefix = substr($line,0,47); $line = substr($line,47); while ( length($line) > 0 ) { print $prefix.substr($line,0,$w-47); if ( length($line) > $w-47 ) { $line = substr($line,$w-47); } else { $line = ''; } $prefix = ' 'x47; } print "\n"; } for ( @lines ) { my $pid = $1 if /${user} ([0-9]+)/; print "Kill process $pid?"; my $yn = <>; $t->cmd("kill $pid") if $yn =~ /^y$/i; } __END__ :endofperl