复制代码
- @echo off
- for /f "tokens=15 delims= " %%i in ('ipconfig /all ^| FIND /I "address"') do echo %%i
- for /f "tokens=15 delims= " %%i in ('ipconfig /all ^| FIND /I "Subnet"') do echo %%i
- for /f "tokens=15 delims= " %%i in ('ipconfig /all ^| FIND /I "DNS"') do echo %%i
- pause
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Test>type test.bat @echo off for /f "tokens=15 delims= " %%i in ('ipconfig /all^|find /i "address"') do echo/%%i for /f "tokens=15 delims= " %%i in ('ipconfig /all^|find /i "Subnet"') do echo/%%i for /f "tokens=15 delims= " %%i in ('ipconfig /all^|find /i "DNS"') do echo/%%i for /f "tokens=13 delims= " %%i in ('ipconfig /all^|find /i "Gateway"') do echo/%%i C:\Test>test.bat 192.168.56.3 255.255.255.0 192.168.56.2 192.168.56.1 |
复制代码
- @echo off
- for /f "usebackq tokens=15 delims= " %%i in (
- `"ipconfig /all | FIND /I "address" &
- ipconfig /all^| FIND /I "Subnet "^&
- ipconfig /all^| FIND /I "DNS""`
- ) do echo %%i
- pause
复制代码
- @echo off
- FOR /F ["options"] %variable IN (
- `"command1 &
- command2^&
- ...... ^&
- command3"`
- ) do (
- command
- )
- pause
欢迎光临 批处理之家 (http://bathome.net./) | Powered by Discuz! 7.2 |