Get Interface name, IP and MAC in Windows Command line

前端 未结 3 2083
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-13 01:18

I want to get a list of all the interfaces, IP and MAC address on a machine. I have quite a few machines to get this information from (around 600) and I can\'t use a batch f

3条回答
  •  没有蜡笔的小新
    2021-01-13 02:08

    asked: I can't use a batch file on the devices. I would like to send the command and get back an echoed output.
    my solution try to use a single commands row.
    Also I use 2 loops to better refine the data search.

    so try this solution too:

    @for /f "skip=2 delims=, tokens=1,2,3,4" %L in ('wmic nic where "netenabled=true" get macaddress^,index^,netconnectionid^,productname /format:csv') do @for /f "skip=2 delims={}, tokens=2" %A in ('wmic nicconfig where "index=%M" get ipaddress^,ipsubnet ^/format:csv') do @echo %L - %O - %N - %A
    

提交回复
热议问题