内网中hostname对应ip查询

作者: admin 分类: 实用脚本 发布时间: 2016-11-15 15:12
@echo off
title Local IP address finder
:start
setlocal EnableDelayedExpansion

set i=0
for /F %%a in ('net view') do (
   set line=%%a
   if "!line:~0,2!" equ "\\" (
      set h=!line:~2!
      for /f "tokens=2delims=[]" %%t in ('ping -n 1 !h!') do (echo !h! ^=^> %%t)
   )
)

个人更推荐使用 nbtscan.exe

标签云