- @echo off
- for /f "tokens=1,2,* delims=.: " %%1 in ('ipconfig /all') do (
- if defined DNS_Servers (
- set DNS_Servers_2=%%1.%%2.%%3
- call set Ethernet_adapter=%%Ethernet_adapter::=%%
- goto Next
- ) else set %%1_%%2=%%3
- )
-
- :Next
- SetLocal EnableDelayedExpansion
- for %%a in (
- Ethernet_adapter
- Physical_Address
- IP_Address
- Subnet_Mask
- Default_Gateway
- DNS_Servers
- DNS_Servers_2
- ) do echo %%a=!%%a!
- pause
复制代码
|