I am trying to use this command to grab an IP address that is 10.0.0.5
Primarly to test piping to the FOR command. Hence i'm piping to it and using 'more' in the (..)
But it is not getting the 10 part of the IP.
Any idea what is happening here?
What is going wrong?
Code: Select all
C:\>ipconfig | findstr "Address" | for /f "tokens=13" %f in ('more') do @echo %f
.
C:\>ipconfig | findstr "Address" | for /f "tokens=14" %f in ('more') do @echo %f
:
C:\>ipconfig | findstr "Address" | for /f "tokens=15" %f in ('more') do @echo %f
0.0.0.5
C:\>ipconfig | findstr "Address" | for /f "tokens=15" %f in ('more') do @echo %f
>c:\blah\p.p
C:\>type c:\blah\p.p
.0.0.5
This works
Code: Select all
C:\>for /f "tokens=15" %f in ('ipconfig ^| findstr "Address"') do @echo %f
10.0.0.5
C:\>
But I want to do it via the piping method, hence with 'more' in the round brackets