[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
On Fri, 20 Feb 2009 10:32:40 +0000
Grant Sewell wrote:
> Hi all,
>
> I'm trying to create a variable in a batch file that contains the
> result of an application. Under BASH I would do something like:
>
> var=`date`
> echo $var
>
> Under "batch", if I do the following, it fails:
>
> set var=`date /t`
> echo %var%
>
> This merely echos `date /t` to the command prompt.
>
> What I'm actually trying to achieve is to have the output of an awk
> script (a single line, showing the currently configured LAN IP
> address) stored in a variable in the batch file for use later.
>
> Any thoughts? (other than "use perl/python/c++" :p)
>
> Cheers.
> Grant.
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%
Grant.
--
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