[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
On Fri, 2009-02-20 at 12:03 +0000, Grant Sewell wrote: > Nevermind. I have it sorted now. The code in question is: > > ipconfig /all > lanset > For /F "tokens=* delims=" %%A in ('awk.exe -f ip.awk lanset') Do Set IPADDR=%%A > echo %IPADDR% I don't know what your awk is doing but this is quite close without using a temporary file: for /F "tokens=1,2 delims=:" %%A in ('"ipconfig /all | find "IP Address""') do set IPADDR=%%B The single quotes inside the brackets allow you to grab the output of a command. However if you want to use pipes you need a set of double quotes on the inside of that. It's a pretty nasty syntax. The above actually leaves a space character before the ip address. This solves that for /F "tokens=1,2 delims=:" %%A in ('"ipconfig /all | find "IP Address""') do (for /F "tokens=1 delims= " %%P in ('echo %%B') do set IPADDR=%%P) Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United Kingdom. Company Reg No 2096520. VAT Reg No GB 348 3873 20. -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html