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

kxyes 2004-07-26 11:19:45
windows脚本编程中怎么取得域名对应的IP地址??
...全文
96 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
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;
}
}
}

6,868

社区成员

发帖
与我相关
我的任务
社区描述
Windows 2016/2012/2008/2003/2000/NT
社区管理员
  • Windows Server社区
  • qishine
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧