Solved How to get each line value from txt file in cmd

May 15, 2012 at 09:03:48
Specs: Windows XP
hi....

I need to get each line value from txt file in batch script

readme.txt CONTENTS::

AUTHOR: USER
ITERATION: 100

I need to get USER and 100 from text file and need to store in variable.

Can anyone pls help me in solving this.


See More: How to get each line value from txt file in cmd

Report •

#1
May 15, 2012 at 09:41:32
✔ Best Answer
Is that all the file contains? If so:

@echo off
for /f "tokens=1,2 delims= " %%a in (
readme.txt
) do (
if [%%a]==[AUTHOR:] (
set author=%%b
) else (
if [%%a]==[ITERATION:] (
set iteration=%%b
)
)
)
echo %author%
echo %iteration%

Tony


Report •

#2
May 15, 2012 at 23:44:58
Thank you.... Its working fine....

Report •
Related Solutions


Ask Question