@echo off
rem 局域网通过IP查询电脑网络名
dir /a %systemdrive%windowssystem32
btstat.exe 1>nul 2>nul && set "path64=%systemdrive%windowssystem32" || set "path64=%systemdrive%windowssysnative"
rem echo %path64%
title=局域网通过IP查询电脑网络名
set /p IP=请输入局域网IP(例如192.168.1.100):
rem %path64%
btstat.exe -A %IP%|find "唯一"
for /f "tokens=1 delims=< " %%a in ('%path64%
btstat.exe -A %IP%^|find "唯一"') do if not defined name set name=%%a
rem echo %IP%对应的主机名:%name%
echo %IP%对应的主机名:%name%
echo %name%|clip
echo 电脑名字%name%已经复制到剪贴板,按任意键退出!
pause 1>nul 2>nul