Hi ,
I have this wierd issue,
Iam going to remotely extract the IP address from test tool which we we ues. What I wanted was something which could do like
ipconfig /all |find "IP Address" > text.txt
this is currently doing
IP Address. . . . . . . . . . . . : 137.117.176.102
Can we just push the 137.117.176.102 part straight to the file ..
Is it possible , I am writing some clumsy C code in my test tool to do that , but it would be better if I execute this system command from C which would simply output my IP and then I pick it up .....
Thanks
PS
Extract something from a output - is this possible .?
Moderator: DosItHelp
-
- Posts: 2
- Joined: 29 Sep 2008 12:14
-
- Posts: 36
- Joined: 17 Jul 2008 07:37
This is a bit of a kludge using a temp file but it works:
Code: Select all
setlocal
ipconfig | find "IP Address"> "%temp%\ipline.txt"
set /p ipline=<"%temp%\ipline.txt"
for /f "tokens=1-14 delims=: " %%a in ("%ipline%") DO set ipline=%%n
Or:
Code: Select all
for /f "tokens=2,* delims=:. " %%a in ('"ipconfig|find "IP Address""') do set ip=%%b
echo.%ip%