Copy values from txt to var in other txt

January 12, 2011 at 15:19:28
Specs: Windows XP
Hello all!

My problem is that i have 1 txt file with values by lines that i need to put in specific location in other text file and outputed as a third text file.
Like this:

(line1) 123
(line2) 456
(line3) 789
(line4) 010
(line5) 101

(line2)SentTime=11-01-2011 15:11:11

(line2)SentTime=11-01-2011 15:11:11

How can i make a Batch Script to copy each line of file1.txt to the varX's at file2.txt and output as txt file also?

Thanks in advance for your help!

See More: Copy values from txt to var in other txt

Report •

January 13, 2011 at 20:31:45
Set _InputFile="Path to external text file goes here"
For /F "tokens=1,2* delims=:" %%A IN (%_InputFile%) DO Set _var%%A=%%C

the text file should look like this

1:whatever:your command

just use the echo command and you will be set

echo %_var1%
this will show up as "your command"

let me know if you need any more help

Report •

January 14, 2011 at 01:59:10
Thanks for your attencion on this.... Im a little bit lost in your code.

Meanwhilhe i try to use this code:

@echo off > newfile.txt
setLocal EnableDelayedExpansion
set /p new=<a.txt
for /f "delims=" %%a in (b.txt) do (
set str=%%a
set str=!str:000=%new%!
echo !str! >> newfile.txt

This code almost do the job, the only problem is that it replace all de "000" with the same value from the first line.
The point is to replace all the "000" by the values from A.txt witch are in each line.

Thanks a lot :D

Report •

Related Solutions

Ask Question