in reply to How can get remote IP of Windows OS?
cheers#!perlenv -w use strict; use Net::Ping; if ($#ARGV < 0) { print "usage: ping.pl <hostname>"; exit; } my $host = $ARGV[0]; my $file = "IPAddress.txt"; open (FILE, ">$file"); my $p = Net::Ping->new(); my ($ret, $duration, $ip) = $p->ping($host, 5.5); print "$host [ip: $ip] is alive.\n" if $p->ping($host); $p->close(); print FILE $ip; close(FILE);
|
|---|