|
如下:- ipconfig /all > "%temp%\temp.txt"
- for /f "tokens=15" %%i in ('type "%temp%\temp.txt" ^| find /i "IP Address"') do set myip=%%i
- for /f "tokens=13" %%i in ('type "%temp%\temp.txt" ^| find /i "Default Gateway"') do set mywg=%%i
- for /f "tokens=15" %%i in ('type "%temp%\temp.txt" ^| find /i "DNS Servers"') do set dns=%%i
- for /f "tokens=15" %%i in ('type "%temp%\temp.txt" ^| find /i "Subnet Mask"') do set mymsk=%%i
- echo.IP Configuration
- echo IP Address. . . . . . . . . . . . :%myip%
- echo Subnet Mask . . . . . . . . . . . :%mymsk%
- echo Default Gateway . . . . . . . . . :%mywg%
- echo DNS Servers . . . . . . . . . . . :%dns%
- for /f "tokens=1-4 delims=." %%i in ("%myip%") do (
- set mynet=%%i.%%j.%%k
- set BaseIP=%%l
- )
- del /s /q /f "%temp%\temp.txt"
复制代码 写入文件后使用 |
|