Windows与其他系统批量区分

我正在写一个批处理脚本,其中我应该区分Windows和非Windows系统(Linux,MAC OS,交换机,施乐机器等)。

algorithm:

if (it is a Windows System) then do this end if 

为了做到这一点,我正在尝试借助nbtstat命令。 据我所知,当执行nbtstat -A [IP Address] ,如果[IP Address]是Windows系统,则会显示如下输出:

 >nbtstat -A 172.22.73.15 Local Area Connection: Node IpAddress: [172.22.73.15] Scope Id: [] NetBIOS Remote Machine Name Table Name Type Status --------------------------------------------- MANDAR-PC <00> UNIQUE Registered DOMAIN <00> GROUP Registered MANDAR-PC <20> UNIQUE Registered DOMAIN <1E> GROUP Registered MAC Address = 00-1E-0B-9D-DD-E9 

对于非Windows系统,输出将是:

 >nbtstat -A 172.22.246.51 Local Area Connection: Node IpAddress: [172.22.73.15] Scope Id: [] Host not found. 

我如何使用nbtstat或其他命令来区分Windows和其他系统?

 nbtstat -A 172.22.246.51 | find /i "Host not found." >nul 2>&1 && ( echo not a windows ) || (echo windows)