Reading specific value from a string

April 13, 2011 at 04:07:07
Specs: Windows XP

I have been reading all the similar threads around but I can't manage to do that.
What i need to achieve is fairly easy (I think) but I cant get it to work.

I have a log file (*.DMP) where I need to find for several strings like this one:

Successfully changed user to XXX

where XXX is the name i need to output..

There might be several occurences of this line but I just need to grab the last one and echo this var.

Any help would be great. Thanks in advance!

See More: Reading specific value from a string

Report •

April 13, 2011 at 12:06:30
Hi Drkz

This Help

@echo off
for /f "tokens=1-5 delims= " %%a in ('type x.dmp ^| find "Successfully changed user to"') do (
set User=%%e
echo %User%

Report •
Related Solutions

Ask Question