convert variable from file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
koos147
Posts: 2
Joined: 21 Aug 2014 08:52

convert variable from file

#1 Post by koos147 » 21 Aug 2014 09:08

Hello

i have a txt file with variable for example
source.list

Code: Select all

%Fname%.%Lname%@domain.com
%Fname%%Lname%@domain.com


i have a batch script where the variable are set (i can echo them to the screen)
now i want to read the lines from source.list and write them to destenation.list

Code: Select all

for /f "tokens=*" %%b in (c:\temp\source.list) do echo %%b>>c:\temp\destenation.list


The expected result would be

Code: Select all

john.do@domain.com
johndo@domain.com


but the result i got is

Code: Select all

%Fname%.%Lname%@domain.com
%Fname%%Lname%@domain.com


can someone explain what i do wrong?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: convert variable from file

#2 Post by foxidrive » 21 Aug 2014 09:26

use

Code: Select all

call echo


JFTR parsing files with variable names like that is not a normal way of getting a result.

koos147
Posts: 2
Joined: 21 Aug 2014 08:52

Re: convert variable from file

#3 Post by koos147 » 22 Aug 2014 02:16

thanks it works

the source file is needed because the script it self must be generic

If you have a better way of handling this,any input is welcome

Post Reply