获取已连接的网络连接/以太网适配器名称

@echo off

set "NetID="
for /f "tokens=1* delims==" %%a in ('wmic nic where "NetEnabled=TRUE and not Name like '%%Virtual%%'" get NetConnectionID /value^|find "="') do set NetID=%%b
if defined NetID (
    echo;%NetID%
)
netsh interface ip show dns %NetID%

pause

0 条评论

昵称

沙发空缺中,还不快抢~