• 全部
  • 问答

windows脚本编程中怎么取得域名对应的IP地址??

kxyes 2004-07-26 11:19:45
windows脚本编程中怎么取得域名对应的IP地址??
...全文
48 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
kxyes 2004-07-28
怎么没人up啊
回复
kxyes 2004-07-26
有没有js的或vbs的啊
回复
icuc88 2004-07-26
哈哈,一个perl的例子。

use Net::hostent;
use Socket; @ARGV = ('www.sunisco.com') unless @ARGV; for $host ( @ARGV ) { unless ($h = gethost($host)) {
warn "$0: no such host: $host\n";
next;
} printf "\n%s is %s%s\n",
$host,
lc($h->name) eq lc($host) ? "" : "*really* ",
$h->name; print "\taliases are ", join(", ", @{$h->aliases}), "\n"
if @{$h->aliases}; if ( @{$h->addr_list} > 1 ) {
my $i;
for $addr ( @{$h->addr_list} ) {
printf "\taddr #%d is [%s]\n", $i++, inet_ntoa($addr);
}
} else {
printf "\taddress is [%s]\n", inet_ntoa($h->addr);
} if ($h = gethostbyaddr($h->addr)) {
if (lc($h->name) ne lc($host)) {
printf "\tThat addr reverses to host %s!\n", $h->name;
$host = $h->name;
redo;
}
}
}
回复
发帖
Windows Server
创建于2007-08-02

6596

社区成员

Windows 2016/2012/2008/2003/2000/NT
申请成为版主
帖子事件
创建了帖子
2004-07-26 11:19
社区公告
暂无公告