Capturing text from file

View: New views
3 Messages — Rating Filter:   Alert me  

Capturing text from file

by inferno1424-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

    {13-23-FE-45-ZN} RVG_SW  C:\address\location1.exe

Above is output taken from reg query and placed in a .txt file.  It
contains 4 spaces at the beginning.  What I would like is to capture
the information between the brackets { } (and including the brackets)
and assign it to a variable.

Any ideas on how I would do this?

*Note the values between the brackets may change based on when the
output is generated.  
<nabble_a href="new.txt">new.txt</nabble_a>

Any help would be appreciated.


Re: Capturing text from file

by foxidrive-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 01 Feb 2008 06:00:56 -0000, "inferno1424" <inferno1424@...>
wrote:

>    {13-23-FE-45-ZN} RVG_SW  C:\address\location1.exe
>
>Above is output taken from reg query and placed in a .txt file.  It
>contains 4 spaces at the beginning.  What I would like is to capture
>the information between the brackets { } (and including the brackets)
>and assign it to a variable.

@echo off
for /f %%a in ('type "text file.txt"') do set var=%%a


Re: Capturing text from file

by inferno1424-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you foxidrive,

Works like a charm!
--- In batchworld@..., foxidrive <micm@...> wrote:

>
> On Fri, 01 Feb 2008 06:00:56 -0000, "inferno1424" <inferno1424@...>
> wrote:
>
> >    {13-23-FE-45-ZN} RVG_SW  C:\address\location1.exe
> >
> >Above is output taken from reg query and placed in a .txt file.  It
> >contains 4 spaces at the beginning.  What I would like is to capture
> >the information between the brackets { } (and including the brackets)
> >and assign it to a variable.
>
> @echo off
> for /f %%a in ('type "text file.txt"') do set var=%%a
>