D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] OT: Win/DOS "batch" programming question about variables...

 

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.

-- 
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