for /f %%a in ('wmic nicconfig where^(ipenabled^=true^) get index^|findstr [0-99]') do set i=%%a
wmic nicconfig where(index=%i%) call enablestatic ("192.168.91.61","172.18.0.2"), ("255.255.255.0","255.255.0.0")
wmic nicconfig where(index=%i%) call setgateways ("192.168.91.1","172.18.0.1"),(1,2)
温馨提示:答案为网友推荐,仅供参考